line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Harriet; |
2
|
1
|
|
|
1
|
|
870
|
use 5.008005; |
|
1
|
|
|
|
|
4
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
17
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
438
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "00.05"; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
0
|
|
|
0
|
0
|
|
my ($class, $dir) = @_; |
10
|
0
|
|
|
|
|
|
bless {dir => $dir}, $class; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub load { |
14
|
0
|
|
|
0
|
0
|
|
my ($self, $name) = @_; |
15
|
0
|
0
|
|
|
|
|
return if $self->{loaded}->{$name}++; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $file = "$self->{dir}/${name}.pl"; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $retval = do $file; |
20
|
0
|
0
|
|
|
|
|
if ($@) { |
21
|
0
|
|
|
|
|
|
die "[Harriet] Couldn't parse $file: $@\n"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub load_all { |
26
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
opendir my $dh, $self->{dir} |
29
|
0
|
0
|
|
|
|
|
or die "[Harriet] Cannot open '$self->{dir}' as directory: $!\n"; |
30
|
0
|
|
|
|
|
|
while (my $file = readdir($dh)) { |
31
|
0
|
0
|
|
|
|
|
next unless $file =~ /^(.*)\.pl$/; |
32
|
0
|
|
|
|
|
|
my $name = $1; |
33
|
0
|
|
|
|
|
|
$self->load($name); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
__END__ |