Branch Coverage

blib/lib/Locale/XGettext.pm
Criterion Covered Total %
branch 119 236 50.4


line true false branch
44 217 222 if defined $what and length $what
53 0 52 if (ref $class) { }
64 0 52 if ('Locale::XGettext' eq ref $self)
71 49 3 if &__empty($options->{'default_domain'})
72 0 52 if &__empty($options->{'default_domain'})
73 49 3 if &__empty($options->{'output_dir'})
75 0 52 if (exists $options->{'add_location'})
77 0 0 if (&__empty($option))
80 0 0 if $option ne 'full' and $option ne 'file' and $option ne 'never'
84 4 48 if (exists $options->{'add_comments'})
85 0 4 if (not ref $options->{'add_comments'} and 'ARRAY' ne $options->{'add_comments'})
96 52 0 if &__empty($options->{'from_code'})
101 0 52 if ($cd->getError) { }
112 39 13 if ($self->needInputFiles)
114 0 0 unless @{$self->{'__files'};} or @{$options->{'files_from'};}
120 1 51 if (exists $options->{'exclude_file'} and not ref $options->{'exclude_file'})
133 0 0 if (ref $class) { }
140 0 0 if ($@)
144 0 0 if $options{'help'}
146 0 0 if ($options{'version'})
165 0 45 if ($self->{'__run'}++)
172 1 44 if ($self->option('join_existing'))
174 0 1 if ('-' eq $output_file)
182 0 40 unless my $path = $self->resolveFilename($filename)
185 0 40 if ($path =~ /\.pot?$/i) { }
196 44 1 if ($po->entries || $self->{'__options'}{'force_po'} and not $self->{'__options'}{'omit_header'})
215 3 38 length $directory ? :
217 40 1 if stat $path
230 0 1 unless my $entries = 'Locale::PO'->load_file_asarray($path)
235 1 1 if ('""' eq $entry->msgid and &__empty(scalar $entry->dequote($entry->msgctxt)))
248 0 55 unless ($self->{'__run'})
255 0 55 unless (ref $entry)
262 6 49 if (defined $comment)
275 0 13 if ($token eq 'fuzzy') { }
0 13 elsif ($token eq 'no-wrap') { }
0 13 elsif ($token eq 'wrap') { }
1 12 elsif ($token =~ /^[a-z]+-(?:format|check)$/) { }
290 1 1 if not $valid
297 5 1 if (not &__empty($comment) and defined $comment_keywords)
300 5 1 if ($comment =~ /($keyword.*)/s)
307 1 4 unless &__empty($old_automatic)
308 5 0 if @automatic
313 55 0 unless (&__empty($msgid))
315 55 0 if &__empty($ctx)
317 1 54 if exists $self->{'__exclude'}{$msgid}{$ctx}
369 6 92 if &__empty($from_code)
373 0 98 if ($from_code ne 'US-ASCII' and $from_code ne 'UTF-8')
375 0 0 if defined $cd->getError
381 147 245 defined $_ ? :
386 98 0 if ($from_code eq 'US-ASCII') { }
0 0 elsif ($from_code eq 'UTF-8') { }
389 0 98 unless ($flesh =~ /^[\000-\177]*$/)
400 0 0 unless (utf8::valid($flesh))
407 0 0 unless (&__empty($msgid))
408 0 0 unless $cd->recode($msgid)
414 0 0 unless (&__empty($msgid_plural))
415 0 0 unless $cd->recode($msgid_plural)
421 0 0 unless (&__empty($msgstr))
422 0 0 unless $cd->recode($msgstr)
428 0 0 if ($msgstr_n)
430 0 0 unless $cd->recode($msgstr_0)
433 0 0 unless $cd->recode($msgstr_1)
442 0 0 unless $cd->recode($comment)
457 51 98 unless exists $self->{'__options'}{$key}
473 0 9 unless ($self->{'__run'})
478 0 9 unless ($self->{'__po'})
483 0 0 unless $self->{'__po'}->entries or $self->{'__options'}{'force_po'}
488 0 9 unless open my $fh, '>', $filename
497 0 18 unless print $fh $dump
501 0 9 unless close $fh
517 0 0 if @options & 3
533 0 0 unless $options
543 0 0 $lineno ? :
544 0 0 if ($pos < $limit)
553 0 0 if (@description and $pos > 77 - length($description[-1]))
585 0 0 unless defined $version
613 51 1 unless $files
616 0 1 unless my $entries = 'Locale::PO'->load_file_asarray($file)
622 0 2 if &__empty($msgid)
625 1 1 if &__empty($ctx)
637 54 1 unless (&blessed($entry))
642 7 47 if (defined $keyword)
644 7 0 if (exists $keywords->{$keyword})
646 2 5 unless &__empty($comment)
652 2 7 if $keyword ne $flag->function
653 1 6 if $flag->arg != $sg_arg and $flag->arg != $pl_arg
655 0 6 if $flag->no
662 2 52 if (defined $flags)
665 3 0 unless $po_entry->has_flag($flag)
674 0 101 if $@
696 3 7 if (exists $options->{'output'}) { }
1 6 elsif ('-' eq $options->{'default_domain'}) { }
697 1 2 if ('File::Spec'->file_name_is_absolute($options->{'output'}) or '-' eq $options->{'output'}) { }
719 3 41 if ($options->{'foreign_user'}) { }
725 40 1 unless defined $copyright
746 2 42 if (defined $package_name) { }
748 1 1 if defined $package_version and length $package_version
757 43 1 unless defined $msgid_bugs_address
775 0 0 unless open my $fh, '<', $filename
783 0 0 if ($line =~ /^[\x09-\x0d ]*$/) { }
784 0 0 if (length $chunk)
798 0 0 if (length $chunk)
816 42 0 unless $seen{$canonical}++
824 0 3 unless open my $fh, '<', $potfile
828 0 6 if $file =~ /^[ \x09-\x0d]*#/
830 0 6 unless length $file
833 1 5 if $seen{$canonical}++
913 0 0 unless defined $options{$key}
926 0 7 if ('' eq $option)
932 0 7 if (ref $option) { }
952 0 10 unless my $obj = 'Locale::XGettext::Util::Flag'->newFromString($spec)
961 1 9 if $flags{$function}{$flag}{$arg}
975 0 0 if ($self->needInputFiles) { }
992 0 0 if (defined $self->fileInformation)
1090 0 0 if ($self->canExtractAll)
1096 0 0 if ($self->canKeywords)
1185 0 0 if (defined $url)
1199 0 0 if ($message) { }