line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::Array::Packed::Auto; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
69226
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
71
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
192
|
|
5
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
21
|
|
|
2
|
|
|
|
|
528
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $force_pure_perl_backend; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
if ($force_pure_perl_backend or |
12
|
|
|
|
|
|
|
not eval { require Tie::Array::Packed }) { |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @ISA = 'Tie::Array::Packed'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
require Tie::Array::PackedC; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my @short = qw(c C F f d i I i! I! s! S! l! L! n N v V); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my %map = ( Char => 'c', |
21
|
|
|
|
|
|
|
UnsignedChar => 'C', |
22
|
|
|
|
|
|
|
NV => 'F', |
23
|
|
|
|
|
|
|
Number => 'F', |
24
|
|
|
|
|
|
|
FloatNative => 'f', |
25
|
|
|
|
|
|
|
DoubleNative => 'd', |
26
|
|
|
|
|
|
|
Integer => 'i', |
27
|
|
|
|
|
|
|
UnsignedInteger => 'I', |
28
|
|
|
|
|
|
|
IntegerNative => 'i!', |
29
|
|
|
|
|
|
|
UnsignedIntegerNative => 'I!', |
30
|
|
|
|
|
|
|
ShortNative => 's!', |
31
|
|
|
|
|
|
|
UnsignedShortNative => 'S!', |
32
|
|
|
|
|
|
|
LongNative => 'l!', |
33
|
|
|
|
|
|
|
UnsignedLongNative => 'L!', |
34
|
|
|
|
|
|
|
UnsignedShortNet => 'n', |
35
|
|
|
|
|
|
|
UnsignedShortBE => 'n', |
36
|
|
|
|
|
|
|
UnsignedLongNet => 'N', |
37
|
|
|
|
|
|
|
UnsignedLongBE => 'N', |
38
|
|
|
|
|
|
|
UnsignedShortVax => 'v', |
39
|
|
|
|
|
|
|
UnsignedShortLE => 'v', |
40
|
|
|
|
|
|
|
UnsignedLongVax => 'V', |
41
|
|
|
|
|
|
|
UnsignedLongLE => 'V' ); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
@map{@short} = @short; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
for my $name (keys %map) { |
46
|
|
|
|
|
|
|
my $type = $map{$name}; |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
2
|
|
9
|
no strict 'refs'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
484
|
|
49
|
|
|
|
|
|
|
@{"Tie::Array::Packed::${name}::ISA"} = __PACKAGE__; |
50
|
36
|
|
|
36
|
|
102
|
*{"Tie::Array::Packed::${name}::packer"} = sub { $type }; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $next_id = 'TieArrayPackedAuto0000'; |
56
|
|
|
|
|
|
|
my %id; |
57
|
|
|
|
|
|
|
my %class; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
our $AUTOLOAD; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub AUTOLOAD { |
62
|
36
|
|
|
36
|
|
153
|
my $self = shift; |
63
|
36
|
|
33
|
|
|
290
|
my $class = ref $self || $self; |
64
|
36
|
50
|
|
|
|
215
|
$class{$class} and croak qq(Can't locate object method "$AUTOLOAD" via package "$class"); |
65
|
36
|
|
|
|
|
117
|
$class{$class} = 1; |
66
|
36
|
|
|
|
|
136
|
my $packer = $self->packer; |
67
|
36
|
100
|
|
|
|
139
|
unless ($id{$packer}) { |
68
|
32
|
|
|
|
|
81
|
$next_id++; |
69
|
32
|
|
|
|
|
103
|
$id{$packer} = $next_id; |
70
|
32
|
|
|
|
|
398
|
Tie::Array::PackedC->import($id{$packer}, $packer); |
71
|
|
|
|
|
|
|
|
72
|
32
|
|
|
|
|
154830
|
my $parent = "Tie::Array::PackedC::$id{$packer}"; |
73
|
2
|
|
|
2
|
|
11
|
no strict 'refs'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
102
|
|
74
|
32
|
|
|
|
|
77
|
*{$parent.'::_TieArrayPackedAuto_TIEARRAY'} = *{$parent.'::TIEARRAY'}; |
|
32
|
|
|
|
|
288
|
|
|
32
|
|
|
|
|
162
|
|
75
|
|
|
|
|
|
|
} |
76
|
2
|
|
|
2
|
|
9
|
no strict 'refs'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
446
|
|
77
|
36
|
|
|
|
|
80
|
push @{$class.'::ISA'}, "Tie::Array::PackedC::$id{$packer}"; |
|
36
|
|
|
|
|
767
|
|
78
|
36
|
|
|
|
|
1833
|
$self->$AUTOLOAD(@_); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub make { |
82
|
38
|
|
|
38
|
0
|
304143
|
my $class = shift; |
83
|
38
|
|
|
|
|
344
|
tie my(@self), $class, '', @_; |
84
|
|
|
|
|
|
|
return \@self |
85
|
38
|
|
|
|
|
2613
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub make_with_packed { |
88
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
89
|
0
|
|
|
|
|
0
|
tie my(@self), $class, @_; |
90
|
|
|
|
|
|
|
return \@self |
91
|
0
|
|
|
|
|
0
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub TIEARRAY { |
94
|
|
|
|
|
|
|
# local $_[1] = $_[1]; |
95
|
|
|
|
|
|
|
# shift->_TieArrayPackedAuto_TIEARRAY(@_); |
96
|
|
|
|
|
|
|
|
97
|
42
|
|
|
42
|
|
10944
|
my $class = shift; |
98
|
42
|
|
|
|
|
103
|
my $str = shift; |
99
|
42
|
|
|
|
|
1039
|
$class->_TieArrayPackedAuto_TIEARRAY($str, @_); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
__END__ |