line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Application::Plugin::AutoRunmode::FileDelegate; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
23589
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
377
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.18'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new{ |
9
|
4
|
|
|
4
|
0
|
9877
|
my ($pkg, @directories) = @_; |
10
|
4
|
|
|
|
|
12
|
foreach my $directory (@directories){ |
11
|
|
|
|
|
|
|
# keep taint-mode happy where ./ is not in @INC |
12
|
5
|
50
|
|
|
|
24
|
$directory = "./$directory" unless (index ($directory, '/') == 0); |
13
|
|
|
|
|
|
|
# check if the directory exists |
14
|
5
|
50
|
|
|
|
138
|
croak "$directory is not a directory" unless -d $directory; |
15
|
|
|
|
|
|
|
} |
16
|
4
|
|
|
|
|
36
|
return bless \@directories, $pkg; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub can{ |
20
|
2
|
|
|
2
|
0
|
5
|
my($self, $name) = @_; |
21
|
|
|
|
|
|
|
# check the directories |
22
|
2
|
|
|
|
|
5
|
foreach (@$self){ |
23
|
3
|
100
|
|
|
|
63
|
if (-e "$_/$name.pl"){ |
24
|
2
|
|
|
|
|
982
|
my $can = do "$_/$name.pl"; |
25
|
2
|
50
|
33
|
|
|
39
|
if ($@ or $!){ |
26
|
0
|
|
|
|
|
0
|
croak "could not evaluate runmode in file $_/$name.pl: $@ $!"; |
27
|
|
|
|
|
|
|
} |
28
|
2
|
50
|
|
|
|
20
|
return $can if ref $can eq 'CODE'; |
29
|
0
|
|
|
|
|
|
croak "runmode file $_/$name.pl did not return a subroutine reference"; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return UNIVERSAL::can($self, $name); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |