MySQL-Util-CLI
view release on metacpan or search on metacpan
bin/mysql-util view on Meta::CPAN
#!/usr/bin/env perl
# vim: tabstop=4 expandtab
=head1 NAME
mysql-util - a cli utility for MySQL::Util
=head1 VERSION
version 0.002
=cut
###### PACKAGES ######
use Modern::Perl;
use warnings FATAL => 'all';
use Data::Printer alias => 'pdump';
use CLI::Driver;
use File::ShareDir 'dist_file';
use File::Basename;
use Getopt::Long;
Getopt::Long::Configure('no_ignore_case');
Getopt::Long::Configure('pass_through');
Getopt::Long::Configure('no_auto_abbrev');
###### CONSTANTS ######
use constant DIST_NAME => 'MySQL-Util-CLI';
###### GLOBALS ######
use vars qw(
$Action
$CliDriver
);
###### MAIN ######
$| = 1;
$CliDriver = CLI::Driver->new( path => get_cli_driver_path() );
parse_cmd_line();
my $action = $CliDriver->get_action( name => $Action );
if ($action) {
$action->do;
}
else {
$CliDriver->fatal("failed to find action in config file");
}
###### END MAIN ######
sub get_repo_dir {
my $bindir = dirname $0;
my $devdir = dirname $bindir;
return $devdir;
}
sub get_cli_driver_path {
#
# first attempt to find the driver file in the git repo location
#
my $sharedir = sprintf "%s/share", get_repo_dir();
if ( -f "$sharedir/cli-driver.yml" ) {
# local development location
return $sharedir;
}
#
( run in 0.546 second using v1.01-cache-2.11-cpan-39bf76dae61 )