line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Replica; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
require Exporter; |
6
|
5
|
|
|
5
|
|
300515
|
use base qw/Exporter/; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
575
|
|
7
|
5
|
|
|
5
|
|
32
|
use Carp; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
9441
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT = qw/replica_of/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub replica_of { |
12
|
5
|
|
|
5
|
0
|
1011
|
my $sample = shift; |
13
|
|
|
|
|
|
|
|
14
|
5
|
|
|
|
|
18
|
my $r = ref( $sample ); |
15
|
|
|
|
|
|
|
return |
16
|
5
|
100
|
|
|
|
84
|
$r eq 'HASH' ? Acme::Replica::_mode_hash_ref( $sample ) : |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$r eq 'ARRAY' ? Acme::Replica::_mode_array_ref( $sample ) : |
18
|
|
|
|
|
|
|
$r eq 'SCALAR' ? Acme::Replica::_mode_scalar_ref( $sample ) : |
19
|
|
|
|
|
|
|
!$r ? Acme::Replica::_mode_scalar( $sample ) : |
20
|
|
|
|
|
|
|
croak 'Not a (SCALAR|ARRAY|HASH) reference.' |
21
|
|
|
|
|
|
|
; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _mode_hash_ref { |
25
|
1
|
|
|
1
|
|
4
|
my ( $hash_ref,) = @_; |
26
|
1
|
|
|
|
|
3
|
my %replica_hash = (); |
27
|
1
|
|
|
|
|
5
|
for ( keys %$hash_ref ) { |
28
|
2
|
|
|
|
|
9
|
$replica_hash{ Acme::Replica::_add_invisible_character($_) } = $hash_ref->{ $_ }; |
29
|
|
|
|
|
|
|
} |
30
|
1
|
|
|
|
|
9
|
return %replica_hash; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _mode_array_ref { |
34
|
1
|
|
|
1
|
|
2
|
my ( $array_ref,) = @_; |
35
|
1
|
|
|
|
|
2
|
my @replica_array = (); |
36
|
1
|
|
|
|
|
3
|
for ( @$array_ref ) { |
37
|
2
|
|
|
|
|
7
|
push @replica_array, Acme::Replica::_add_invisible_character($_); |
38
|
|
|
|
|
|
|
} |
39
|
1
|
|
|
|
|
6
|
return @replica_array; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _mode_scalar_ref { |
43
|
1
|
|
|
1
|
|
3
|
my ( $scalar_ref,) = @_; |
44
|
1
|
|
|
|
|
4
|
return Acme::Replica::_add_invisible_character( $$scalar_ref ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _mode_scalar { |
48
|
1
|
|
|
1
|
|
3
|
my ($scalar,) = @_; |
49
|
1
|
|
|
|
|
5
|
return Acme::Replica::_add_invisible_character( $scalar ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _add_invisible_character { |
53
|
6
|
|
|
6
|
|
9
|
my ($str,) = @_; |
54
|
6
|
|
|
|
|
27
|
return pack('H2', '1c') . $str; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
__END__ |