| 1 | package PMLTQ::Commands; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | our $AUTHORITY = 'cpan:MATY'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | $PMLTQ::Commands::VERSION = '1.5.0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # ABSTRACT: PMLTQ command line interface | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use PMLTQ::Base -strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Cwd qw/getcwd abs_path/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use File::Basename 'fileparse'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Getopt::Long (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Hash::Merge 'merge'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use List::MoreUtils 'apply'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use PMLTQ::Loader qw/find_modules load_class/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use YAML::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | sub DEFAULT_CONFIG { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | my $base_dir = shift || getcwd(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DEFAULT_CONFIG: not called CC=2 SCAR=17.9
Pod
undocumented
Condition0%0/3
shift() || getcwd()
MC/DC0%0/2
shift() || getcwd()
shift()
getcwd()
Truth table0%0/3
A || B
A= shift()B= getcwd()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | data_dir => File::Spec->catdir( $base_dir, 'data' ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | output_dir => File::Spec->catdir( $base_dir, 'sql_dump' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | resources => File::Spec->catdir( $base_dir, 'resources' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | db => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | host => 'localhost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | port => 5432 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | isFree => 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | isAllLogged => 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | isPublic => 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | isFeatured => 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | info => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | fields => 'name' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | my ( $self, $name, @args ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | if ( $name && $name =~ /^\w+$/ && ( $name ne 'help' || $args[0] ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$name and $name =~ /^\w+$/ and $name ne "help" || $args[0]
$name and $name =~ /^\w+$/
$name ne "help" or $args[0]
MC/DC0%0/4
$name and $name =~ /^\w+$/ and $name ne "help" || $args[0]
$name
$name =~ /^\w+$/
$name ne "help"
$args[0]
Truth table0%0/5
A and B and C or D
A= $nameB= $name =~ /^\w+$/C= $name ne "help"D= $args[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | $name = shift @args if my $help = $name eq 'help'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $command = _command( "PMLTQ::Command::$name", \@args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | return $help ? $command->help : $command->run(@args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | print "Available commands:\n\t", join( "\n\t", sort { $a cmp $b } _available_commands() ), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | sub _available_commands { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | apply {s/^PMLTQ::Command:://} find_modules('PMLTQ::Command'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
_available_commands: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | sub _command { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | my ( $module, $args ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_command: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | die qq{Unknown command "$module", maybe you need to install it?\n} unless load_class($module); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | die qq{Command doesn't inherit from PMLTQ::Command} unless $module->isa('PMLTQ::Command'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $config = _parse_args($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | return $module->new( config => $config ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | sub _parse_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | my $args = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_args: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $p = Getopt::Long::Parser->new( config => [qw/pass_through no_ignore_case no_auto_abbrev/] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $config_file = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $config = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $command_line_config = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my @unprocessed_args = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | $p->getoptionsfromarray( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | $args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 'c|config=s' => \$config_file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | '<>' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | my $arg = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my ( $path, $value ) = $arg =~ m/^--([a-z0-9-_]+)=(.*)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | unless ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | push @unprocessed_args, $arg; # push back to args | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my @path = split /-/, $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $name = pop @path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $ref = $command_line_config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | while ( my $part = shift @path ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | $ref->{$part} = {} unless defined $ref->{$part}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $ref = $ref->{$part}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $ref->{$name} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if ( $config_file ne '--' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ($config_file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | die "Configuration file '$config_file' does not exists or is not readable" unless -r $config_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | $config_file = File::Spec->catfile( getcwd(), 'pmltq.yml' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | $config_file = undef unless -r $config_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | push @$args, @unprocessed_args if @unprocessed_args > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $config = _load_config($config_file) if $config_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | return merge( $command_line_config, merge( $config, DEFAULT_CONFIG ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | sub _load_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $config_file = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_config: not called CC=19 SCAR=59.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | my $yaml_str; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | if ( $config_file eq '--' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $yaml_str = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | local $/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | <STDIN>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | eval { $data = YAML::Tiny->read_string($yaml_str) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | eval { $data = YAML::Tiny->read($config_file) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ( $@ && $@ =~ m/YAML_LOAD_ERR/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/3
$@ and $@ =~ /YAML_LOAD_ERR/
MC/DC0%0/2
$@ and $@ =~ /YAML_LOAD_ERR/
$@
$@ =~ /YAML_LOAD_ERR/
Truth table0%0/3
A and B
A= $@B= $@ =~ /YAML_LOAD_ERR/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | die "Unable to load config file '$config_file'\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ▶ | } elsif ( $@ && $@ =~ m/YAML_PARSE_ERR/ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$@ and $@ =~ /YAML_PARSE_ERR/
MC/DC0%0/2
$@ and $@ =~ /YAML_PARSE_ERR/
$@
$@ =~ /YAML_PARSE_ERR/
Truth table0%0/3
A and B
A= $@B= $@ =~ /YAML_PARSE_ERR/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $@ =~ s/\n.*//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | die "Unable to parse config file '$config_file'\n\t$@\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | ▶ | } elsif ( $config_file eq '--' && !$data ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config_file eq "--" and not $data
MC/DC0%0/2
$config_file eq "--" and not $data
$config_file eq "--"
not $data
Truth table0%0/3
A and not(B)
A= $config_file eq "--"B= not $data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | die "Unable to parse config from STDIN:\n$yaml_str\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } elsif ( !$data ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | die "Unable to open config file '$config_file'\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $config = $data->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $base_dir = $config->{base_dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | unless ($base_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ( undef, $base_dir, undef ) = fileparse($config_file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $base_dir = abs_path($base_dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | $config->{db} = {} unless $config->{db}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | $config->{db}->{name} = $config->{treebank_id} if ( $config->{treebank_id} && !$config->{db}->{name} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$config->{"treebank_id"} and not $config->{"db"}{"name"}
MC/DC0%0/2
$config->{"treebank_id"} and not $config->{"db"}{"name"}
$config->{"treebank_id"}
not $config->{"db"}{"name"}
Truth table0%0/3
A and not(B)
A= $config->{"treebank_id"}B= not $config->{"db"}{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | for ( grep { $config->{$_} } qw/data_dir resources output_dir/ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $config->{$_} = abs_path( File::Spec->rel2abs( $config->{$_}, $base_dir ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if ( $config->{layers} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | for my $lr ( @{ $config->{layers} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | $lr->{'related-schema'} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | [ map { abs_path( File::Spec->rel2abs( $_, $config->{resources} ) ) } @{ $lr->{'related-schema'} } ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if $lr->{'related-schema'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | $lr->{filelist} = abs_path( File::Spec->rel2abs( $lr->{filelist}, $base_dir ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if $lr->{filelist} && !File::Spec->file_name_is_absolute( $lr->{filelist} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$lr->{"filelist"} and not "File::Spec"->file_name_is_absolute($lr->{"filelist"})
MC/DC0%0/2
$lr->{"filelist"} and not "File::Spec"->file_name_is_absolute($lr->{"filelist"})
$lr->{"filelist"}
not "File::Spec"->file_name_is_absolute($lr->{"filelist"})
Truth table0%0/3
A and not(B)
A= $lr->{"filelist"}B= not "File::Spec"->file_name_is_absolute($lr->{"filelist"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return merge( $config, DEFAULT_CONFIG($base_dir) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||