line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Array; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw(Object); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
509
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
0
|
|
|
0
|
0
|
|
my $pkg = shift; |
9
|
0
|
|
|
|
|
|
my @args = @_; |
10
|
0
|
|
|
|
|
|
return bless \@args, $pkg; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub each { |
14
|
0
|
|
|
0
|
0
|
|
my ( $self, $sub ) = @_; |
15
|
0
|
|
|
|
|
|
for my $i ( 0 .. scalar(@$self) - 1 ) { |
16
|
0
|
|
|
|
|
|
$sub->( $self->[$i], $i ); |
17
|
|
|
|
|
|
|
} |
18
|
0
|
|
|
|
|
|
return $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub pop { |
22
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
23
|
0
|
|
|
|
|
|
return pop @$self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub push { |
27
|
0
|
|
|
0
|
0
|
|
my ( $self, $value ) = @_; |
28
|
0
|
|
|
|
|
|
push @$self, $value; |
29
|
0
|
|
|
|
|
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub shift { |
33
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
34
|
0
|
|
|
|
|
|
return shift @$self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub unshift { |
38
|
0
|
|
|
0
|
0
|
|
my ( $self, $value ) = @_; |
39
|
0
|
|
|
|
|
|
unshift @$self, $value; |
40
|
0
|
|
|
|
|
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub sort { |
44
|
0
|
|
|
0
|
0
|
|
my ( $self, $sub ) = @_; |
45
|
0
|
|
|
|
|
|
my @tmp; |
46
|
0
|
0
|
|
|
|
|
if ( defined $sub ) { |
47
|
0
|
|
|
|
|
|
@tmp = sort { $sub->( $a, $b ) } @$self; |
|
0
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
else { |
50
|
0
|
|
|
|
|
|
@tmp = sort @$self; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
return Array->new(@tmp); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub size { |
56
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
57
|
0
|
|
|
|
|
|
return scalar(@$self); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub get { |
61
|
0
|
|
|
0
|
0
|
|
my ( $self, $index ) = @_; |
62
|
0
|
|
|
|
|
|
return $self->[$index]; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub join { |
66
|
0
|
|
|
0
|
0
|
|
my ( $self, $expr ) = @_; |
67
|
0
|
|
|
|
|
|
return join( $expr, @$self ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |