line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
701
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
72
|
|
2
|
|
|
|
|
|
|
require 5.005; # needs 4-arg substr |
3
|
|
|
|
|
|
|
$Tie::CharArray::VERSION = '1.00'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# POD documentation after __END__ below |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Tie::CharArray; |
8
|
1
|
|
|
1
|
|
4
|
use base 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
115
|
|
9
|
1
|
|
|
1
|
|
19
|
use vars '@EXPORT_OK'; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
705
|
|
10
|
|
|
|
|
|
|
@EXPORT_OK = qw( chars codes ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub chars ($) { |
14
|
3
|
|
|
3
|
0
|
48
|
tie my @chars, 'Tie::CharArray', $_[0]; |
15
|
3
|
100
|
|
|
|
9
|
return wantarray ? @chars : \@chars; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
sub codes ($) { |
18
|
1
|
|
|
1
|
0
|
6
|
tie my @codes, 'Tie::CharArray::Ord', $_[0]; |
19
|
1
|
50
|
|
|
|
4
|
return wantarray ? @codes : \@codes; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub TIEARRAY { |
24
|
11
|
|
|
11
|
|
111
|
my $class = shift; |
25
|
11
|
0
|
0
|
|
|
23
|
require Carp and Carp::carp("Too many parameters for tie to $class") |
|
|
|
33
|
|
|
|
|
26
|
|
|
|
|
|
|
if @_ > 1 and $^W; |
27
|
11
|
100
|
|
|
|
24
|
my $self = @_ ? \\$_[0] : \\(my $foo = ""); |
28
|
11
|
|
|
|
|
31
|
bless $self, $class; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
20
|
|
|
20
|
|
20
|
sub FETCH { return substr $${$_[0]}, $_[1], 1; } |
|
20
|
|
|
|
|
59
|
|
32
|
5
|
|
|
5
|
|
12
|
sub FETCHSIZE { return length $${$_[0]}; } |
|
5
|
|
|
|
|
19
|
|
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
2
|
|
8
|
sub STORE { substr $${$_[0]}, $_[1], 1, $_[2]; } |
|
2
|
|
|
|
|
12
|
|
35
|
0
|
|
|
0
|
|
0
|
sub STORESIZE { substr $${$_[0]}, $_[1], length($${$_[0]})-$_[1], ""; } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
36
|
0
|
|
|
0
|
|
0
|
sub EXISTS { return $_[1] < length $${$_[0]}; } |
|
0
|
|
|
|
|
0
|
|
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
|
0
|
sub CLEAR { $${$_[0]} = ""; } |
|
0
|
|
|
|
|
0
|
|
39
|
3
|
|
|
3
|
|
12
|
sub PUSH { $${$_[0]} .= join "" => @_[1..$#_]; } |
|
3
|
|
|
|
|
14
|
|
40
|
0
|
|
|
0
|
|
0
|
sub POP { return substr $${$_[0]}, -1, 1, ""; } |
|
0
|
|
|
|
|
0
|
|
41
|
0
|
|
|
0
|
|
0
|
sub SHIFT { return substr $${$_[0]}, 0, 1, ""; } |
|
0
|
|
|
|
|
0
|
|
42
|
1
|
|
|
1
|
|
7
|
sub UNSHIFT { $${$_[0]} = join "" => @_[1..$#_], $${$_[0]}; } |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
43
|
0
|
|
|
0
|
|
0
|
sub SPLICE { return split // => substr $${$_[0]}, $_[1], $_[2], join "" => @_[3..$#_]; } |
|
0
|
|
|
|
|
0
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
package Tie::CharArray::Ord; |
47
|
1
|
|
|
1
|
|
7
|
use base 'Tie::CharArray'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
373
|
|
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
1
|
|
6
|
sub FETCH { return ord substr $${$_[0]}, $_[1], 1; } |
|
1
|
|
|
|
|
9
|
|
50
|
2
|
|
|
2
|
|
4
|
sub STORE { substr $${$_[0]}, $_[1], 1, chr $_[2]; } |
|
2
|
|
|
|
|
8
|
|
51
|
1
|
|
|
1
|
|
5
|
sub PUSH { $${$_[0]} .= pack 'C*' => @_[1..$#_]; } |
|
1
|
|
|
|
|
9
|
|
52
|
2
|
|
|
2
|
|
8
|
sub POP { return ord substr $${$_[0]}, -1, 1, ""; } |
|
2
|
|
|
|
|
5
|
|
53
|
0
|
|
|
0
|
|
|
sub SHIFT { return ord substr $${$_[0]}, 0, 1, ""; } |
|
0
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
|
|
sub UNSHIFT { $${$_[0]} = (pack 'C*' => @_[1..$#_]) . $${$_[0]}; } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
|
|
sub SPLICE { return unpack 'C*' => substr $${$_[0]}, $_[1], $_[2], pack 'C*' => @_[3..$#_]; } |
|
0
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
"That's all, folks!" |
59
|
|
|
|
|
|
|
__END__ |