line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Module::Spec::OO; |
3
|
|
|
|
|
|
|
$Module::Spec::OO::VERSION = '0.9.0'; |
4
|
|
|
|
|
|
|
# ABSTRACT: OO support for Module::Spec |
5
|
1
|
|
|
1
|
|
750
|
use 5.012; |
|
1
|
|
|
|
|
3
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
432
|
use Class::Method::Modifiers 1.05 (); # install_modifier |
|
1
|
|
|
|
|
1330
|
|
|
1
|
|
|
|
|
153
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %CLASSES; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my @METHODS = qw(need_module try_module generate_code); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub create_class { |
15
|
0
|
|
|
0
|
0
|
|
my ( $self, $version ) = @_; |
16
|
0
|
0
|
|
|
|
|
return $CLASSES{$version} if $CLASSES{$version}; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $base = "Module::Spec::V$version"; |
19
|
0
|
|
|
|
|
|
my $class = "${base}::OO"; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $e; |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
|
|
|
|
|
local $@; |
|
0
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
eval( my $code |
25
|
|
|
|
|
|
|
= "package $class; require $base; our \@ISA = qw($base);" ); |
26
|
0
|
0
|
|
|
|
|
$e = "Evaling failed: $@\nTrying to eval:\n${code}" if $@; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Allow certain functions in the base class to act as methods |
30
|
|
|
|
|
|
|
Class::Method::Modifiers::install_modifier( |
31
|
|
|
|
|
|
|
$class, |
32
|
|
|
|
|
|
|
around => @METHODS, |
33
|
|
|
|
|
|
|
sub { |
34
|
0
|
|
|
0
|
|
|
return $_[0]->( @_[ 2 .. $#_ ] ); # Discard invocant |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $CLASSES{$version} = $class; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |