Branch Coverage

blib/lib/Rose/HTML/Object/Message/Localizer.pm
Criterion Covered Total %
branch 151 232 65.0


line true false branch
88 704 0 if (@_)
90 704 0 if (@_ == 1) { }
0 0 elsif (@_ % 2 == 0) { }
104 0 0 wantarray ? :
124 0 0 if @_
134 0 2211 unless $message->can("text") and $message->can("id")
135 1860 351 if $message->is_custom
139 351 0 if ($parent->can("parent"))
144 132 219 if ($parent and $parent->isa("Rose::HTML::Object::Error"))
149 346 5 $parent ? :
188 4 0 $parent->can('parent') ? :
0 4 $parent->can('parent_form') ? :
40 4 $parent->can('parent_field') ? :
193 4 40 if ($parent)
204 351 40 if defined $text
215 94 38 unless ref $_[0] eq "CODE"
223 351 0 $args ? :
228 68 128 if (my $ref = ref $value)
230 28 40 if ($ref eq 'ARRAY') { }
246 2 13 defined $3 ? :
15 0 ref $args{$2} ? :
274 70 0 if (defined $messages_class->get_message_name($error_id)) { }
0 0 elsif (not $error_id =~ /^\d+$/) { }
292 6 345 if $args->{'variant'}
294 12 333 if (defined(my $count = $args->{'count'}))
319 3 3 $count == 2 ? :
3 6 $count == 1 ? :
3 9 $count == 0 ? :
355 7713 2170 if (exists $msgs->{$name} and exists $msgs->{$name}{$locale})
357 2572 5141 if (ref $msgs->{$name}{$locale}) { }
0 5141 elsif ($variant eq 'default') { }
359 0 2572 $msgs->{$name}{$locale}{$variant} ? :
376 0 0 wantarray ? :
0 0 unless ref $msgs->{$name}
379 0 0 wantarray ? :
394 0 102 unless defined $text
396 0 102 if ($name =~ /[^A-Z0-9_]/)
402 0 102 if ($id and $name) { }
0 102 elsif (not defined $name) { }
102 0 elsif (not defined $id) { }
404 0 0 unless ($name eq $self->messages_class->get_message_name($id))
411 0 0 unless defined $id
412 0 0 unless $name = $self->messages_class->get_message_name($id)
417 0 102 unless defined $name
418 0 102 unless $id = $self->messages_class->get_message_id($name)
422 100 2 unless (ref $text eq "HASH")
431 0 0 $variant ? :
0 104 if $Debug
435 7 97 if ($variant) { }
437 5 2 if (ref $msgs->{$name}{$l}) { }
445 0 2 if (defined $existing)
456 0 97 if (ref ref $msgs->{$name}{$l}) { }
474 0 2 if ($Rose::HTML::Object::Exporter::Target_Class) { }
489 0 1 unless @_
491 0 1 if ($Rose::HTML::Object::Exporter::Target_Class) { }
511 1 16 unless defined $text
513 0 16 if ($name =~ /[^A-Z0-9_]/)
519 5 11 unless (ref $text eq "HASH")
529 1 15 if (defined &$const)
538 0 26 if $Debug
583 1 5 unless my $name = $args{'name'}
589 1 4 if (defined &$const)
603 0 0 if $code
628 383 62 if (exists $msgs->{$name} and exists $msgs->{$name}{$locale})
630 12 12 if (ref $msgs->{$name}{$locale} and exists $msgs->{$name}{$locale}{$variant})
635 339 32 if $variant eq "default"
638 44 95 if $try == 2
663 0 10292 if ($self->localized_message_exists($name, $locale, $variant))
673 944 9348 if (fileno $fh)
677 912 32 if ($Data_Pos{$from_class}) { }
692 51 893 if defined $text
703 0 10197 if $seen{$class}++
706 40 10157 if defined $msg
719 1 3 if (@_)
721 0 1 @_ == 1 && ref $_[0] eq 'ARRAY' ? :
726 0 1 wantarray ? :
1 2 if defined $locales
728 1 1 if (my $locales = $ENV{'RHTMLO_LOCALES'})
730 1 0 unless ref $locales
732 0 1 wantarray ? :
735 0 1 wantarray ? :
744 0 128 if (@_)
750 0 128 if defined $ret
752 1 127 if ($ENV{'MOD_PERL'} and !defined($ENV{'RHTMLO_PRIME_CACHES'}) || $ENV{'RHTMLO_PRIME_CACHES'} or $ENV{'RHTMLO_PRIME_CACHES'})
767 1 2 if (@_ > 1) { }
781 3 0 if (fileno $fh)
785 2 1 if ($Data_Pos{$from_class}) { }
797 0 3 if $Debug
807 2 0 if (@_ == 1) { }
0 0 elsif (@_ > 1) { }
813 0 0 if @_ % 2 != 0
818 0 2 unless my $file = delete $args{'file'}
820 0 2 unless open $args{'fh'}, $file
831 947 3 if $args{'force_utf8'}
833 3 947 if (ref $locales eq 'ARRAY') { }
944 6 elsif ($locales and not ref $locales) { }
835 2 1 @$locales ? :
842 0 950 if (ref $variants eq 'ARRAY') { }
944 12 elsif ($variants and not ref $variants) { }
844 0 0 @$variants ? :
853 944 6 if ($msg_names)
855 944 0 if (not ref $msg_names) { }
0 0 elsif (ref $msg_names eq 'ARRAY') { }
0 0 elsif (ref $msg_names eq 'Regexp') { }
884 914 31301 if /$End_Messages/o
888 4 31297 if (/$End_Message/o and !$2 || $2 eq $in_msg) { }
4 31293 elsif ($in_msg) { }
3453 27840 elsif (/$Locale_Declaration/o) { }
16701 11139 elsif (/$Message_Spec/o) { }
4 11135 elsif (/$Start_Message/o) { }
0 11135 elsif (not /$Comment_Or_Blank/o) { }
890 0 0 if (not $msg_names or $msg_names->{$in_msg} or $msg_re and $in_msg =~ /$msg_re/)
924 91 952 if (!$locales || $locales->{$in_locale} and !$variants || $$variants{$2 or 'default'} and !$msg_names || $msg_names->{$1})
948 51 40 if $msg_names
966 0 950 wantarray ? :
974 1 0 @_ == 1 ? :