DatadirDumper/CLI.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 41 CC 3 SCAR 17.5
CC
3
Cov
0%
parse_options
12.0
run
2.0
BEGIN
2.0
CRAP 5.8
1 package Test::mysqld::DatadirDumper::CLI;
2 use strict;
3 use warnings;
4  
5 use Getopt::Long;
6 use Test::mysqld::DatadirDumper;
7  
8 sub run {
9 my ($class, @argv) = @_;
10  
11 my ($opt,) = $class->parse_options(@argv);
12 Test::mysqld::DatadirDumper->new($opt)->dump;
13 }
14  
15 sub parse_options {
16 my ($class, @argv) = @_;
17  
18 my $parser = Getopt::Long::Parser->new(
19 config => [qw/posix_default no_ignore_case/],
20 );
21 local @ARGV = @argv;
22 $parser->getoptions(\my %opt, qw/
23 ddl=s
24 datadir=s
25 fixtures=s@
26 /);
27 for my $opt (qw/ddl datadir/) {
28 die "$opt option is required!" unless exists $opt{$opt};
29 }
30  
31 if (exists $opt{fixtures}) {
32 $opt{fixtures} = [
33 map { split /,/, $_ } @{ $opt{fixtures} }
34 ];
35 }
36 $opt{ddl_file} = delete $opt{ddl};
37  
38 (\%opt, \@ARGV);
39 }
40  
41 1;