line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::DynamicSubModule; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
51472
|
use 5.008008; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
73
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Preloaded methods go here. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$Module::DynamicSubModule::isDebugMode = 1; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use vars qw|$AUTOLOAD|; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
177
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new($$$@){ |
16
|
0
|
|
|
0
|
1
|
|
shift; |
17
|
0
|
|
|
|
|
|
my $sBaseName = shift; |
18
|
0
|
|
|
|
|
|
my $sName = shift; |
19
|
0
|
0
|
0
|
|
|
|
return {} if(!defined $sName or $sName eq ''); |
20
|
0
|
0
|
|
|
|
|
return if $sName eq 'DESTROY'; |
21
|
0
|
|
|
|
|
|
my $sClassName = $sBaseName.'::'.ucfirst($sName); |
22
|
0
|
|
|
|
|
|
eval "require $sClassName"; |
23
|
0
|
0
|
|
|
|
|
if(!$@){ |
24
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
228
|
|
25
|
0
|
|
|
|
|
|
return $sClassName->new(@_); |
26
|
|
|
|
|
|
|
}else{ |
27
|
0
|
0
|
|
|
|
|
print STDERR $@ if $Module::DynamicSubModule::isDebugMode; |
28
|
0
|
0
|
|
|
|
|
return if !defined $sName; |
29
|
0
|
|
0
|
|
|
|
shift while scalar(@_) > 0 and !defined $_[0]; |
30
|
0
|
0
|
|
|
|
|
return if scalar(@_)%2==0; |
31
|
0
|
|
|
|
|
|
my %hE = ($sName,@_); |
32
|
0
|
|
|
|
|
|
return bless \%hE,$sBaseName; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
sub AUTOLOAD{ |
36
|
0
|
|
|
0
|
|
|
my $oS = shift; |
37
|
0
|
|
|
|
|
|
my $sAlgoName = substr($AUTOLOAD,rindex($AUTOLOAD,'::')+2); |
38
|
0
|
0
|
|
|
|
|
return if $sAlgoName eq 'DESTROY'; |
39
|
0
|
|
|
|
|
|
$oS->new($sAlgoName,@_); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |