App::Cmdline::Options::DB - set of database-related options for command-line applications


version 0.1.0


   # In your module that represents a command-line application:
   sub opt_spec {
       my $self = shift;
       return $self->check_for_duplicates (
           [ 'check|c' => "only check the configuration"  ],
           $self->composed_of (
               'App::Cmdline::Options::DB',     # here are the database options added
               'App::Cmdline::Options::Basic',  # here may be other options


This is a kind of a role module, defining a particular set of command-line options and their validation. See more about how to write a module that represents a command-line application and that uses this set of options in App::Cmdline.


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"                       ],


It specifies the database name. No default value.


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


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


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


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


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


Martin Senger <>


This software is copyright (c) 2012 by Martin Senger, CBRC - KAUST (Computational Biology Research Center - King Abdullah University of Science and Technology) All Rights Reserved.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.