GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Bigtop::ScriptHelp(3) User Contributed Perl Documentation Bigtop::ScriptHelp(3)

Bigtop::ScriptHelp - A helper modules for command line utilities

    #!/usr/bin/perl
    use Bigtop::ScriptHelp;

    my $default = Bigtop::ScriptHelp->get_minimal_default();
    my $tree    = Bigtop::Parser->parse_string( $default );
    # ...

    my $style   = 'SomeStyle';  # must live in Bigtop::ScriptHelp::Style::

    my $better_default = Bigtop::ScriptHelp->get_big_default(
            $style, $name, $art
    );
    my $better_tree    = Bigtop::Parser->parse_string( $better_default );

    Bigtop::ScriptHelp->augment_tree( $style, $bigtop_tree, $art );

    my $new_field_label = Bigtop::ScriptHelp->default_label( $name );

This module is used by the bigtop and tentmaker scripts. It provides convenience functions for them.

Whenever a user is building or augmenting a bigtop file, they can specify new tables and their relationships via a script help style of their choice. All the styles are modules in the Bigtop::ScriptHelp::Style:: namespace. See "Bigtop::ScriptHelp::Style" for general information about styles and individual modules under its namespace for how each style works. That said, here is a list of the styles available when this was written.

This is the default style.

It allows short text descriptions of database relationships. For example:

    bigtop -n App 'contact<-birth_day'

But recent versions allow you to specify column names, their types, whether they are optional, and to give them literal default values. See "Bigtop::ScriptHelp::Style::Kickstart" for details. This is my favorite style (so it's no surprise that it is the default).

This style must be requested:

    bigtop -n App -s Pg8Live dsninfo username password

It will connect to the database described by the dsninfo with the supplied username and password and create a bigtop file from it. This will create a full AutoCRUD app for the database. The bigtop file will have all the tables, their columns including types and defaults. It will also know about all primary and foreign keys in the original database. Depending on how exotic the input database is, it will also know to autoincrement the primary key.

Writing your own style is easy. See "Bigtop::ScriptHelp::Style" for the requirements and the two existing styles for examples.

All methods are class methods.
get_minimal_default
Params: app_name (optional, defaults to Sample)

Returns: a little default bigtop string suitable for initial building. It has everything you need for your app except tables and controllers.

get_big_default
Params:

    script help style
    app name
    a list of data for the style
    

Returns: a bigtop file suitable for immediately creating an app and starting it.

augment_tree
Params:

    script help style
    a Bigtop::Parser syntax tree (what you got from a parse_* method)
    a string of data for the style (join all elements with spaces)
    

Returns: nothing, but the tree you passed will be updated.

default_label
Params: a new name

Returns: a default label for that name

Example of conversion: if name is birth_date, the label becomes 'Birth Date'.

default_controller
Params: a new table name

Returns: a default label for that table's controller

Example of conversion: if table name is birth_date, the controller becomes 'BirthDate'.

The following functions are meant for internal use, but you might like them too. Don't call them through the class, call them as functions.
valid_ident
Exported by default.

Params: a proposed ident

Returns: true if the ident looks good, false otherwise. Note that the regex is not perfect. For instance, it will allow leading numbers. Further it absolutely will not notice if a table or controller name is reserved.

Phil Crow, <crow.phil@gmail.com>

Copyright (C) 2006-7, Phil Crow

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.

2022-04-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.