| 1 | package Rose::HTML::Objects; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use File::Spec(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use File::Path(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Basename(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | our $VERSION = '0.627'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | our $Debug = 0; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | sub make_private_library | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_private_library: called CC=18 SCAR=28.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | my($packages, $perl) = | |||||||||||||||||||||||||||||||||||||||||
| 21 | Rose::HTML::Objects->private_library_perl(@_); | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | ▶ | my $debug = exists $args{'debug'} ? $args{'debug'} : $Debug; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 3 | ▶ | if($args{'in_memory'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | foreach my $pkg (@$packages) | |||||||||||||||||||||||||||||||||||||||||
| 28 | { | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 149 | my $code = $perl->{$pkg}; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 149 | ▶ | $debug > 2 && warn $code, "\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 149 | my $error; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | TRY: | ||||||||||||||||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 149 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | eval $code; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
generic_object_class: called CC=1 SCAR=0.0
Subroutine
generic_object_class: not called CC=1 SCAR=0.0
Subroutine
generic_object_class: not called CC=1 SCAR=0.0
Subroutine
generic_object_class: not called CC=1 SCAR=0.0
Subroutine
generic_object_class: not called CC=1 SCAR=0.0
Subroutine
generic_object_class: not called CC=1 SCAR=0.0
Subroutine
get_localized_message_text: called CC=1 SCAR=0.0
Subroutine
init_error_class: called CC=1 SCAR=0.0
Subroutine
init_error_class: not called CC=1 SCAR=0.0
Subroutine
init_errors_class: not called CC=1 SCAR=0.0
Subroutine
init_errors_class: not called CC=1 SCAR=0.0
Subroutine
init_message_class: called CC=1 SCAR=0.0
Subroutine
init_message_class: not called CC=1 SCAR=0.0
Subroutine
init_messages_class: called CC=1 SCAR=0.0
Subroutine
init_messages_class: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 149 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 149 | ▶ | die "Could not eval $pkg - $error" if($error); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | else | ||||||||||||||||||||||||||||||||||||||||||
| 45 | { | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | ▶ | my $dir = $args{'modules_dir'} or croak "Missing modules_dir parameter"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | ▶ | mkdir($dir) unless(-d $dir); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | croak "Could not create modules_dir '$dir' - $!" unless(-d $dir); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | foreach my $pkg (@$packages) | |||||||||||||||||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 75 | my @file_parts = split('::', $pkg); | |||||||||||||||||||||||||||||||||||||||||
| 53 | 75 | $file_parts[-1] .= '.pm'; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 75 | my $file = File::Spec->catfile($dir, @file_parts); | |||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 75 | my $file_dir = File::Basename::dirname($file); | |||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 75 | File::Path::mkpath($file_dir); # spews errors to STDERR | |||||||||||||||||||||||||||||||||||||||||
| 59 | 75 | ▶ | croak "Could not make directory '$file_dir'" unless(-d $file_dir); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 75 | ▶ | if(-e $file && !$args{'overwrite'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-e $file and not $args{"overwrite"}
MC/DC0%0/2
-e $file and not $args{"overwrite"}
-e $file
not $args{"overwrite"}
Truth table66%2/3
A and not(B)
A= -e $fileB= not $args{"overwrite"}
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $debug && warn "Refusing to overwrite '$file'"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 75 | ▶ | open(my $fh, '>', $file) or croak "Could not create '$file' - $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 75 | print $fh $perl->{$pkg}; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 75 | ▶ | close($fh) or croak "Could not write '$file' - $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 75 | ▶ | $debug > 2 && warn $perl->{$pkg}, "\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 3 | ▶ | return wantarray ? @$packages : $packages; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | sub private_library_perl | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
private_library_perl: called CC=21 SCAR=30.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 3 | my($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 3 | my $rename = $args{'rename'}; | |||||||||||||||||||||||||||||||||||||||||
| 83 | 3 | my $prefix = $args{'prefix'}; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 3 | ▶ | my $trim_prefix = $args{'trim_prefix'} || 'Rose::'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'trim_prefix'} || 'Rose::'
MC/DC0%0/1
$args{'trim_prefix'} || 'Rose::'
$args{'trim_prefix'}
Truth table50%1/2
A
A= $args{'trim_prefix'}
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 3 | ▶ | my $in_memory = $args{'in_memory'} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'in_memory'} || 0
MC/DC100%1/1
$args{'in_memory'} || 0
$args{'in_memory'}
Truth table100%2/2
A
A= $args{'in_memory'}
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 3 | my $prefix_regex = qr(^$trim_prefix); | |||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | $rename ||= sub | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 295 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 295 | my($name) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 295 | $name =~ s/$prefix_regex/$prefix/; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 295 | return $name; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 3 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$rename ||= sub {
my($name) = shift();
$name =~ s/$prefix_regex/$prefix/;
return $name;
}
MC/DC0%0/2
$rename ||= sub {
my($name) = shift();
$name =~ s/$prefix_regex/$prefix/;
return $name;
}
$rename
sub {
my($name) = shift();
$name =~ s/$prefix_regex/$prefix/;
return $name;
}
Truth table66%2/3
A ||= B
A= $renameB= sub {
my($name) = shift();
$name =~ s/$prefix_regex/$prefix/;
return $name;
}
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 3 | my $save_rename = $rename; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | $rename = sub | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 443 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 443 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 443 | local $_ = $name; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 443 | my $new_name = $save_rename->($name); | |||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 443 | ▶ | if($_ ne $name && (!$new_name || $new_name == 1)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$_ ne $name and !$new_name || $new_name == 1
not $new_name or $new_name == 1
MC/DC33%1/3
$_ ne $name and !$new_name || $new_name == 1
$_ ne $name
not $new_name
$new_name == 1
Truth table50%2/4
A and not(B) or C
A= $_ ne $nameB= not $new_nameC= $new_name == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | { | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 148 | return $_; | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 295 | return $new_name; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 3 | my $class_filter = $args{'class_filter'}; | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 3 | my(%perl, %isa, @packages); | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 3 | require Rose::HTML::Object; | |||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 3 | my $base_object_type = Rose::HTML::Object->object_type_classes; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 3 | my %base_type_object = reverse %$base_object_type; | |||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 3 | my %object_type; | |||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 3 | my $max_type_len = 0; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 3 | ▶ | while(my($type, $base_class) = each(%$base_object_type)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | { | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 201 | $object_type{$type} = $rename->($base_class); | |||||||||||||||||||||||||||||||||||||||||
| 128 | 201 | ▶ | $max_type_len = length($type) if(length($type) > $max_type_len); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 3 | my $object_map_perl =<<"EOF"; | |||||||||||||||||||||||||||||||||||||||||
| 132 | __PACKAGE__->object_type_classes | ||||||||||||||||||||||||||||||||||||||||||
| 133 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 134 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 3 | foreach my $type (sort keys %object_type) | |||||||||||||||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 201 | my $class = $object_type{$type}; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 201 | $object_map_perl .= sprintf(" %-*s => '$class',\n", $max_type_len + 2, qq('$type')); | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 3 | $object_map_perl .=<<"EOF"; | |||||||||||||||||||||||||||||||||||||||||
| 143 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 144 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 3 | my $object_package = $rename->('Rose::HTML::Object'); | |||||||||||||||||||||||||||||||||||||||||
| 147 | 3 | my $message_package = $rename->('Rose::HTML::Object::Message::Localized'); | |||||||||||||||||||||||||||||||||||||||||
| 148 | 3 | my $messages_package = $rename->('Rose::HTML::Object::Messages'); | |||||||||||||||||||||||||||||||||||||||||
| 149 | 3 | my $error_package = $rename->('Rose::HTML::Object::Error'); | |||||||||||||||||||||||||||||||||||||||||
| 150 | 3 | my $errors_package = $rename->('Rose::HTML::Object::Errors'); | |||||||||||||||||||||||||||||||||||||||||
| 151 | 3 | my $localizer_package = $rename->('Rose::HTML::Object::Message::Localizer'); | |||||||||||||||||||||||||||||||||||||||||
| 152 | 3 | my $custom_package = $rename->('Rose::HTML::Object::Custom'); | |||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 3 | my $load_message_and_errors_perl = ''; | |||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 3 | ▶ | unless($in_memory) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | { | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | $load_message_and_errors_perl=<<"EOF"; | |||||||||||||||||||||||||||||||||||||||||
| 159 | use $error_package; | ||||||||||||||||||||||||||||||||||||||||||
| 160 | use $errors_package(); | ||||||||||||||||||||||||||||||||||||||||||
| 161 | use $message_package; | ||||||||||||||||||||||||||||||||||||||||||
| 162 | use $messages_package(); | ||||||||||||||||||||||||||||||||||||||||||
| 163 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 3 | my $std_messages=<<"EOF"; | |||||||||||||||||||||||||||||||||||||||||
| 167 | # Import the standard set of message ids | ||||||||||||||||||||||||||||||||||||||||||
| 168 | use Rose::HTML::Object::Messages qw(:all); | ||||||||||||||||||||||||||||||||||||||||||
| 169 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 3 | my $std_errors=<<"EOF"; | |||||||||||||||||||||||||||||||||||||||||
| 172 | # Import the standard set of error ids | ||||||||||||||||||||||||||||||||||||||||||
| 173 | use Rose::HTML::Object::Errors qw(:all); | ||||||||||||||||||||||||||||||||||||||||||
| 174 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | my %code = | ||||||||||||||||||||||||||||||||||||||||||
| 177 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 178 | $message_package =><<"EOF", | ||||||||||||||||||||||||||||||||||||||||||
| 179 | sub generic_object_class { '$object_package' } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | $messages_package => | ||||||||||||||||||||||||||||||||||||||||||
| 183 | { | ||||||||||||||||||||||||||||||||||||||||||
| 184 | filter => sub | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 3 | s/^(use base.+)/$std_messages$1/m; | |||||||||||||||||||||||||||||||||||||||||
| 187 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | code =><<"EOF", | ||||||||||||||||||||||||||||||||||||||||||
| 190 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 191 | ## Define your new message ids below | ||||||||||||||||||||||||||||||||||||||||||
| 192 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | # Message ids from 0 to 29,999 are reserved for built-in messages. Negative | ||||||||||||||||||||||||||||||||||||||||||
| 195 | # message ids are reserved for internal use. Please use message ids 30,000 | ||||||||||||||||||||||||||||||||||||||||||
| 196 | # or higher for your messages. Suggested message id ranges and naming | ||||||||||||||||||||||||||||||||||||||||||
| 197 | # conventions for various message types are shown below. | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | # Field labels | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | #use constant FIELD_LABEL_LOGIN_NAME => 100_000; | ||||||||||||||||||||||||||||||||||||||||||
| 202 | #use constant FIELD_LABEL_PASSWORD => 100_001; | ||||||||||||||||||||||||||||||||||||||||||
| 203 | #... | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | # Field error messages | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | #use constant FIELD_ERROR_PASSWORD_TOO_SHORT => 101_000; | ||||||||||||||||||||||||||||||||||||||||||
| 208 | #use constant FIELD_ERROR_USERNAME_INVALID => 101_001; | ||||||||||||||||||||||||||||||||||||||||||
| 209 | #... | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | # Generic messages | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | #use constant LOGIN_NO_SUCH_USER => 200_000; | ||||||||||||||||||||||||||||||||||||||||||
| 214 | #use constant LOGIN_USER_EXISTS_ERROR => 200_001; | ||||||||||||||||||||||||||||||||||||||||||
| 215 | #... | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | ### %CODE% ### | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | # This line must be below all the "use constant ..." declarations | ||||||||||||||||||||||||||||||||||||||||||
| 220 | BEGIN { __PACKAGE__->add_messages } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 222 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | $error_package =><<"EOF", | ||||||||||||||||||||||||||||||||||||||||||
| 225 | sub generic_object_class { '$object_package' } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | $errors_package => | ||||||||||||||||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||||||||||||||||
| 230 | filter => sub | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 3 | s/^(use base.+)/$std_errors$1/m; | |||||||||||||||||||||||||||||||||||||||||
| 233 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 3 | code =><<"EOF", | |||||||||||||||||||||||||||||||||||||||||
| 236 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 237 | ## Define your new error ids below | ||||||||||||||||||||||||||||||||||||||||||
| 238 | ## | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | # Error ids from 0 to 29,999 are reserved for built-in errors. Negative | ||||||||||||||||||||||||||||||||||||||||||
| 241 | # error ids are reserved for internal use. Please use error ids 30,000 | ||||||||||||||||||||||||||||||||||||||||||
| 242 | # or higher for your errors. Suggested error id ranges and naming | ||||||||||||||||||||||||||||||||||||||||||
| 243 | # conventions for various error types are shown below. | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | # Field errors | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | #use constant FIELD_ERROR_PASSWORD_TOO_SHORT => 101_000; | ||||||||||||||||||||||||||||||||||||||||||
| 248 | #use constant FIELD_ERROR_USERNAME_INVALID => 101_001; | ||||||||||||||||||||||||||||||||||||||||||
| 249 | #... | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | # Generic errors | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | #use constant LOGIN_NO_SUCH_USER => 200_000; | ||||||||||||||||||||||||||||||||||||||||||
| 254 | #use constant LOGIN_USER_EXISTS_ERROR => 200_001; | ||||||||||||||||||||||||||||||||||||||||||
| 255 | #... | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | ### %CODE% ### | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | # This line must be below all the "use constant ..." declarations | ||||||||||||||||||||||||||||||||||||||||||
| 260 | BEGIN { __PACKAGE__->add_errors } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 262 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | $localizer_package =><<"EOF", | ||||||||||||||||||||||||||||||||||||||||||
| 265 | $load_message_and_errors_perl | ||||||||||||||||||||||||||||||||||||||||||
| 266 | sub init_message_class { '$message_package' } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | sub init_messages_class { '$messages_package' } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | sub init_error_class { '$error_package' } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | sub init_errors_class { '$errors_package' } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | $custom_package =><<"EOF", | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 3 | ▶ | @{[ $in_memory ? "Rose::HTML::Object->import(':customize');" : "use Rose::HTML::Object qw(:customize);" ]} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 3 | ▶ | @{[ $in_memory ? '' : "\nuse $localizer_package;\n" ]} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | __PACKAGE__->default_localizer($localizer_package->new); | ||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | $object_map_perl | ||||||||||||||||||||||||||||||||||||||||||
| 278 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | $object_package =><<"EOF", | ||||||||||||||||||||||||||||||||||||||||||
| 281 | sub generic_object_class { '$object_package' } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 283 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | # | ||||||||||||||||||||||||||||||||||||||||||
| 286 | # Rose::HTML::Object | ||||||||||||||||||||||||||||||||||||||||||
| 287 | # | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 3 | require Rose::HTML::Object; | |||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 3 | foreach my $base_class (qw(Rose::HTML::Object)) | |||||||||||||||||||||||||||||||||||||||||
| 292 | { | ||||||||||||||||||||||||||||||||||||||||||
| 293 | 3 | my $package = $rename->($base_class); | |||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 3 | push(@packages, $package); | |||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 3 | ▶ | if($args{'in_memory'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | { | ||||||||||||||||||||||||||||||||||||||||||
| 299 | # Prevent "Base class package "..." is empty" errors from base.pm | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | 2 | ${"${custom_package}::VERSION"} = $Rose::HTML::Object::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | # XXX" Don't need to do this | ||||||||||||||||||||||||||||||||||||||||||
| 304 | #(my $path = $custom_package) =~ s{::}{/}g; | ||||||||||||||||||||||||||||||||||||||||||
| 305 | #$INC{"$path.pm"} = 123; | ||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 3 | $isa{$package} = [ $custom_package, $base_class ]; | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | $perl{$package} = $class->subclass_perl(package => $package, | ||||||||||||||||||||||||||||||||||||||||||
| 311 | isa => $isa{$package}, | ||||||||||||||||||||||||||||||||||||||||||
| 312 | in_memory => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 313 | default_code => \%code, | ||||||||||||||||||||||||||||||||||||||||||
| 314 | code => $args{'code'}, | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 3 | code_filter => $args{'code_filter'}); | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | # | ||||||||||||||||||||||||||||||||||||||||||
| 319 | # Rose::HTML::Object::Errors | ||||||||||||||||||||||||||||||||||||||||||
| 320 | # Rose::HTML::Object::Messages | ||||||||||||||||||||||||||||||||||||||||||
| 321 | # Rose::HTML::Object::Message::Localizer | ||||||||||||||||||||||||||||||||||||||||||
| 322 | # | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 3 | require Rose::HTML::Object::Errors; | |||||||||||||||||||||||||||||||||||||||||
| 325 | 3 | require Rose::HTML::Object::Messages; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 3 | require Rose::HTML::Object::Message::Localizer; | |||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 3 | foreach my $base_class (qw(Rose::HTML::Object::Error | |||||||||||||||||||||||||||||||||||||||||
| 329 | Rose::HTML::Object::Errors | ||||||||||||||||||||||||||||||||||||||||||
| 330 | Rose::HTML::Object::Messages | ||||||||||||||||||||||||||||||||||||||||||
| 331 | Rose::HTML::Object::Message::Localized | ||||||||||||||||||||||||||||||||||||||||||
| 332 | Rose::HTML::Object::Message::Localizer)) | ||||||||||||||||||||||||||||||||||||||||||
| 333 | { | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 15 | my $package = $rename->($base_class); | |||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 15 | push(@packages, $package); | |||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 15 | $isa{$package} = $base_class; | |||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | $perl{$package} = $class->subclass_perl(package => $package, | ||||||||||||||||||||||||||||||||||||||||||
| 341 | isa => $isa{$package}, | ||||||||||||||||||||||||||||||||||||||||||
| 342 | in_memory => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 343 | default_code => \%code, | ||||||||||||||||||||||||||||||||||||||||||
| 344 | code => $args{'code'}, | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 15 | code_filter => $args{'code_filter'}); | |||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | # | ||||||||||||||||||||||||||||||||||||||||||
| 349 | # Rose::HTML::Object::Customized | ||||||||||||||||||||||||||||||||||||||||||
| 350 | # | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | $perl{$custom_package} = | ||||||||||||||||||||||||||||||||||||||||||
| 353 | $class->subclass_perl(package => $custom_package, | ||||||||||||||||||||||||||||||||||||||||||
| 354 | in_memory => $in_memory, | ||||||||||||||||||||||||||||||||||||||||||
| 355 | default_code => \%code, | ||||||||||||||||||||||||||||||||||||||||||
| 356 | code => $args{'code'}, | ||||||||||||||||||||||||||||||||||||||||||
| 357 | 3 | code_filter => $args{'code_filter'}); | |||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 3 | push(@packages, $custom_package); | |||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | # | ||||||||||||||||||||||||||||||||||||||||||
| 362 | # All other classes | ||||||||||||||||||||||||||||||||||||||||||
| 363 | # | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 3 | foreach my $base_class (sort values %$base_object_type, 'Rose::HTML::Form::Field') | |||||||||||||||||||||||||||||||||||||||||
| 366 | { | ||||||||||||||||||||||||||||||||||||||||||
| 367 | 204 | ▶ | if($class_filter) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | { | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 68 | local $_ = $base_class; | |||||||||||||||||||||||||||||||||||||||||
| 370 | 68 | ▶ | next unless($class_filter->($base_class)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 203 | ▶ | if($in_memory) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | { | ||||||||||||||||||||||||||||||||||||||||||
| 375 | 135 | my $error; | |||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | TRY: | ||||||||||||||||||||||||||||||||||||||||||
| 378 | { | ||||||||||||||||||||||||||||||||||||||||||
| 379 | 135 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 380 | 135 | eval "require $base_class"; | |||||||||||||||||||||||||||||||||||||||||
| 381 | 135 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 135 | ▶ | croak "Could not load '$base_class' - $error" if($error); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 203 | my $package = $rename->($base_class); | |||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 203 | push(@packages, $package); | |||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | 203 | ▶ | unless($isa{$package}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | { | ||||||||||||||||||||||||||||||||||||||||||
| 393 | $isa{$package} = | ||||||||||||||||||||||||||||||||||||||||||
| 394 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 395 | $custom_package, | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 125 | ▶ | $base_type_object{$package} ? $rename->($base_class) : $base_class, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | $perl{$package} = $class->subclass_perl(package => $package, | ||||||||||||||||||||||||||||||||||||||||||
| 401 | isa => $isa{$package}, | ||||||||||||||||||||||||||||||||||||||||||
| 402 | in_memory => $in_memory, | ||||||||||||||||||||||||||||||||||||||||||
| 403 | code => $args{'code'}, | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 203 | code_filter => $args{'code_filter'}); | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 3 | ▶ | return wantarray ? (\@packages, \%perl) : \%perl; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | sub isa_perl | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 221 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isa_perl: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 221 | my($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 221 | ▶ | my $isa = $args{'isa'} or Carp::confess "Missing 'isa' parameter"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | 221 | ▶ | $isa = [ $isa ] unless(ref $isa eq 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | 221 | ▶ | if($args{'in_memory'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | { | ||||||||||||||||||||||||||||||||||||||||||
| 419 | 135 | return 'our @ISA = qw(' . join(' ', @$isa) . ");"; | |||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | else | ||||||||||||||||||||||||||||||||||||||||||
| 422 | { | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 86 | return 'use base qw(' . join(' ', @$isa) . ");"; | |||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 1 | our $Perl; | |||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | sub subclass_perl | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 224 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subclass_perl: called CC=17 SCAR=28.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 224 | my($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | 224 | ▶ | my $package = $args{'package'} or Carp::confess "Missing 'package' parameter"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 434 | 224 | my $isa = $args{'isa'}; | |||||||||||||||||||||||||||||||||||||||||
| 435 | 224 | ▶ | $isa = [ $isa ] unless(ref $isa eq 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 224 | my $filter = $args{'code_filter'}; | |||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 224 | my($code, @code, @default_code); | |||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 224 | foreach my $param (qw(default_code code)) | |||||||||||||||||||||||||||||||||||||||||
| 442 | { | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 448 | ▶ | my $arg = $args{$param} || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{$param} || ''
MC/DC100%1/1
$args{$param} || ''
$args{$param}
Truth table100%2/2
A
A= $args{$param}
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 448 | ▶ | if(ref $arg eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | { | ||||||||||||||||||||||||||||||||||||||||||
| 447 | 170 | $arg = $arg->{$package}; | |||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | 1 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 451 | 448 | ▶ | if(ref $arg eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | { | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 7 | ▶ | if(my $existing_filter = $filter) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | { | ||||||||||||||||||||||||||||||||||||||||||
| 455 | 3 | my $new_filter = $arg->{'filter'}; | |||||||||||||||||||||||||||||||||||||||||
| 456 | $filter = sub | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | 3 | $existing_filter->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 459 | 3 | $new_filter->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 460 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||
| 462 | else | ||||||||||||||||||||||||||||||||||||||||||
| 463 | { | ||||||||||||||||||||||||||||||||||||||||||
| 464 | 4 | $filter = $arg->{'filter'}; | |||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 7 | $arg = $arg->{'code'}; | |||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | 448 | ▶ | if(ref $arg eq 'CODE') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | { | ||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | $code = $arg->($package, $isa); | |||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | else | ||||||||||||||||||||||||||||||||||||||||||
| 475 | { | ||||||||||||||||||||||||||||||||||||||||||
| 476 | 448 | $code = $arg; | |||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 448 | ▶ | if($code) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | { | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 27 | for($code) | |||||||||||||||||||||||||||||||||||||||||
| 482 | { | ||||||||||||||||||||||||||||||||||||||||||
| 483 | 27 | s/^\n*/\n/; | |||||||||||||||||||||||||||||||||||||||||
| 484 | 27 | s/\n*\z/\n/; | |||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||
| 487 | else | ||||||||||||||||||||||||||||||||||||||||||
| 488 | { | ||||||||||||||||||||||||||||||||||||||||||
| 489 | 421 | $code = ''; | |||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 448 | ▶ | if($code) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 493 | { | ||||||||||||||||||||||||||||||||||||||||||
| 494 | 27 | ▶ | if($param eq 'code') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | { | ||||||||||||||||||||||||||||||||||||||||||
| 496 | 6 | push(@code, $code); | |||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||
| 498 | else | ||||||||||||||||||||||||||||||||||||||||||
| 499 | { | ||||||||||||||||||||||||||||||||||||||||||
| 500 | 21 | push(@default_code, $code); | |||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||
| 505 | 224 | foreach my $default_code (@default_code) | |||||||||||||||||||||||||||||||||||||||||
| 506 | { | ||||||||||||||||||||||||||||||||||||||||||
| 507 | 21 | ▶ | if($default_code =~ /\n### %CODE% ###\n/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 508 | { | ||||||||||||||||||||||||||||||||||||||||||
| 509 | 6 | $default_code =~ s/\n### %CODE% ###\n/join('', @code)/me; | |||||||||||||||||||||||||||||||||||||||||
| 510 | 6 | undef @code; # Attempt to reclaim memory | |||||||||||||||||||||||||||||||||||||||||
| 511 | 6 | undef $code; # Attempt to reclaim memory | |||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 224 | local $Perl; | |||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | 224 | $Perl=<<"EOF"; | |||||||||||||||||||||||||||||||||||||||||
| 518 | package $package; | ||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | use strict; | ||||||||||||||||||||||||||||||||||||||||||
| 521 | 224 | ▶ | @{[ $args{'isa'} ? "\n" . $class->isa_perl(%args) . "\n" : '' ]}@{[ join('', @default_code, @code) ]} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | 1; | ||||||||||||||||||||||||||||||||||||||||||
| 523 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | 224 | ▶ | if($filter) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 526 | { | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 78 | local *_ = *Perl; | |||||||||||||||||||||||||||||||||||||||||
| 528 | 78 | $filter->(\$Perl); | |||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | 224 | return $Perl; | |||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||
| 536 | __END__ | ||||||||||||||||||||||||||||||||||||||||||