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