App-Cmdline

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    which - when called with the -h option - shows this nicely formatted
    usage:

        Usage: myapp [short or long options, not bundled]
            -c --check      only check the configuration

            --dbname        database name
            --dbhost        hostname hosting database
            --dbport        database port number
            --dbuser        user name to access database
            --dbpasswd      password to access database
            --dbsocket      UNIX socket accessing the database
            -s --show       show database access properties

            -h              display a short usage message
            -v --version    display a version

  check_for_duplicates
    When you are composing options from more sets, it is worth to check
    whether, unintentionally, some options are not duplicated. It can be
    done by this method that gets the list of options definitions, checks it

docs/App-Cmdline-Options-DB.html  view on Meta::CPAN

<h1><a class='u' href='#___top' title='click to go to top of document'
name="OPTIONS"
>OPTIONS</a></h1>

<p>Particularly, this module specifies the database-related options, allowing to define what database to access and how to authenticate the access. It is particularly well suited for the MySQL DBI access.</p>

<pre>    [ &#39;dbname=s&#39;   =&#62; &#34;database name&#34;                                            ],
    [ &#39;dbhost=s&#39;   =&#62; &#34;hostname hosting database&#34;,    { default =&#62; &#39;localhost&#39; } ],
    [ &#39;dbport=i&#39;   =&#62; &#34;database port number&#34;,         { default =&#62; 3306 }        ],
    [ &#39;dbuser=s&#39;   =&#62; &#34;user name to access database&#34;, { default =&#62; &#39;reader&#39; }    ],
    [ &#39;dbpasswd=s&#39; =&#62; &#34;password to access database&#34;                              ],
    [ &#39;dbsocket=s&#39; =&#62; &#34;UNIX socket accessing the database&#34;                       ],</pre>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="--dbname"
>--dbname</a></h2>

<p>It specifies the database name. No default value.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="--dbhost"

docs/App-Cmdline-Options-DB.html  view on Meta::CPAN

<h2><a class='u' href='#___top' title='click to go to top of document'
name="--dbuser"
>--dbuser</a></h2>

<p>It specifies a user name to access this database. Default value is <code>reader</code>,</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="--dbpasswd"
>--dbpasswd</a></h2>

<p>It specifies a database password for the given user. No default value.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="--dbsocket"
>--dbsocket</a></h2>

<p>It specifies a UNIX socket file name (such as <em>/tmp/mysqld.sock</em>). No default value.</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="AUTHOR"
>AUTHOR</a></h1>

docs/App-Cmdline.html  view on Meta::CPAN


<p>which - when called with the -h option - shows this nicely formatted usage:</p>

<pre>    Usage: myapp [short or long options, not bundled]
        -c --check      only check the configuration

        --dbname        database name
        --dbhost        hostname hosting database
        --dbport        database port number
        --dbuser        user name to access database
        --dbpasswd      password to access database
        --dbsocket      UNIX socket accessing the database
        -s --show       show database access properties

        -h              display a short usage message
        -v --version    display a version</pre>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="check_for_duplicates"
><b>check_for_duplicates</b></a></h2>

lib/App/Cmdline.pm  view on Meta::CPAN

which - when called with the -h option - shows this nicely formatted
usage:

    Usage: myapp [short or long options, not bundled]
        -c --check      only check the configuration

        --dbname        database name
        --dbhost        hostname hosting database
        --dbport        database port number
        --dbuser        user name to access database
        --dbpasswd      password to access database
        --dbsocket      UNIX socket accessing the database
        -s --show       show database access properties

        -h              display a short usage message
        -v --version    display a version

=head2 B<check_for_duplicates>

When you are composing options from more sets, it is worth to check
whether, unintentionally, some options are not duplicated. It can be

lib/App/Cmdline/Options/DB.pm  view on Meta::CPAN


package App::Cmdline::Options::DB;

our $VERSION = '0.1.2'; # VERSION

my @OPT_SPEC = (
    [ 'dbname=s'   => "database name"                                            ],
    [ 'dbhost=s'   => "hostname hosting database",    { default => 'localhost' } ],
    [ 'dbport=i'   => "database port number",         { default => 3306 }        ],
    [ 'dbuser=s'   => "user name to access database", { default => 'reader' }    ],
    [ 'dbpasswd=s' => "password to access database"                              ],
    [ 'dbsocket=s' => "UNIX socket accessing the database"                       ],
    );

# ----------------------------------------------------------------
# Return definition of my options
# ----------------------------------------------------------------
sub get_opt_spec {
    return @OPT_SPEC;
}

lib/App/Cmdline/Options/DB.pm  view on Meta::CPAN

=head1 OPTIONS

Particularly, this module specifies the database-related options,
allowing to define what database to access and how to authenticate the
access. It is particularly well suited for the MySQL DBI access.

    [ 'dbname=s'   => "database name"                                            ],
    [ 'dbhost=s'   => "hostname hosting database",    { default => 'localhost' } ],
    [ 'dbport=i'   => "database port number",         { default => 3306 }        ],
    [ 'dbuser=s'   => "user name to access database", { default => 'reader' }    ],
    [ 'dbpasswd=s' => "password to access database"                              ],
    [ 'dbsocket=s' => "UNIX socket accessing the database"                       ],

=head2 --dbname

It specifies the database name. No default value.

=head2 --dbhost

It specifies the computer name (or its IP address) where is the
database. Default value is C<localhost>.

lib/App/Cmdline/Options/DB.pm  view on Meta::CPAN

It is an integer, specifying a port number where the database is
listening. Default value is 3306 (suited for MySQL).

=head2 --dbuser

It specifies a user name to access this database. Default value is
C<reader>,

=head2 --dbpasswd

It specifies a database password for the given user. No default value.

=head2 --dbsocket

It specifies a UNIX socket file name (such as F</tmp/mysqld.sock>). No
default value.

=head1 AUTHOR

Martin Senger <martin.senger@gmail.com>



( run in 0.752 second using v1.01-cache-2.11-cpan-49f99fa48dc )