line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Submodules::Result;
|
2
|
2
|
|
|
2
|
|
14
|
use File::Spec;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict;
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
35
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
41
|
|
5
|
2
|
|
|
2
|
|
10
|
use Carp;
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
140
|
|
6
|
|
|
|
|
|
|
use overload (
|
7
|
2
|
|
|
|
|
12
|
fallback => 1,
|
8
|
|
|
|
|
|
|
'""' => 'SCALAR',
|
9
|
2
|
|
|
2
|
|
2596
|
);
|
|
2
|
|
|
|
|
2029
|
|
10
|
|
|
|
|
|
|
our $AUTOLOAD;
|
11
|
|
|
|
|
|
|
our $VERSION = '1.0015';
|
12
|
|
|
|
|
|
|
our @CARP_NOT = qw(Submodules);
|
13
|
|
|
|
|
|
|
our $default_property = 'Module';
|
14
|
|
|
|
|
|
|
our $SCALAR = sub {
|
15
|
|
|
|
|
|
|
my $self = shift;
|
16
|
|
|
|
|
|
|
my @call = caller(1);
|
17
|
|
|
|
|
|
|
return $self if $call[0] eq __PACKAGE__;
|
18
|
|
|
|
|
|
|
eval {
|
19
|
|
|
|
|
|
|
$self->isa('UNIVERSAL');
|
20
|
|
|
|
|
|
|
};
|
21
|
|
|
|
|
|
|
return $self if $@;
|
22
|
|
|
|
|
|
|
$self->{$default_property};
|
23
|
|
|
|
|
|
|
};
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub SCALAR {
|
26
|
|
|
|
|
|
|
# Easily oerride stringification through $Submodules::SCALAR
|
27
|
138
|
50
|
|
138
|
|
13001
|
return &$SCALAR(@_) if 'CODE' eq ref $SCALAR;
|
28
|
|
|
|
|
|
|
}
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new {
|
31
|
24
|
|
|
24
|
1
|
35
|
my $class = shift;
|
32
|
24
|
|
|
|
|
184
|
bless {
|
33
|
|
|
|
|
|
|
AbsPath => undef,
|
34
|
|
|
|
|
|
|
Clobber => undef,
|
35
|
|
|
|
|
|
|
Module => undef,
|
36
|
|
|
|
|
|
|
Name => undef,
|
37
|
|
|
|
|
|
|
Path => undef,
|
38
|
|
|
|
|
|
|
RelPath => undef,
|
39
|
|
|
|
|
|
|
@_,
|
40
|
|
|
|
|
|
|
}, $class;
|
41
|
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub require {
|
44
|
12
|
|
|
12
|
1
|
21
|
my $self = shift;
|
45
|
12
|
|
|
|
|
76
|
my @call = caller(0);
|
46
|
12
|
|
|
|
|
23
|
my $r = eval {
|
47
|
12
|
|
|
|
|
2162
|
require "$self->{Path}";
|
48
|
|
|
|
|
|
|
};
|
49
|
12
|
50
|
|
|
|
911
|
if (my $e = $@) {
|
50
|
0
|
0
|
|
|
|
0
|
if ($e =~ /did not return a true value/) {
|
51
|
0
|
|
|
|
|
0
|
die $self->Path." did not return a true value at $call[1] line $call[2]\n";
|
52
|
|
|
|
|
|
|
} else {
|
53
|
0
|
|
|
|
|
0
|
$e =~ s/(Compilation failed in require at) .*?$/$1 $call[1] line $call[2]/g;
|
54
|
0
|
|
|
|
|
0
|
die $e;
|
55
|
|
|
|
|
|
|
}
|
56
|
|
|
|
|
|
|
}
|
57
|
12
|
|
|
|
|
45
|
$r;
|
58
|
|
|
|
|
|
|
}
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub use {
|
61
|
6
|
|
|
6
|
1
|
12
|
my $self = shift;
|
62
|
6
|
|
|
|
|
13
|
$self->require;
|
63
|
6
|
50
|
|
|
|
29
|
if (my $import = $self->Module->can('import')) {
|
64
|
6
|
|
|
|
|
24
|
unshift @_, $self->Module;
|
65
|
6
|
|
|
|
|
21
|
goto &$import;
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
}
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub read {
|
70
|
0
|
|
|
0
|
1
|
0
|
my $self = shift;
|
71
|
0
|
|
|
|
|
0
|
undef local $/;
|
72
|
0
|
0
|
|
|
|
0
|
open my $in, '<', $self->{AbsPath} or croak "Failed to open $self->{AbsPath} for reading: $!";
|
73
|
0
|
|
|
|
|
0
|
binmode $in;
|
74
|
0
|
|
|
|
|
0
|
my $data = <$in>;
|
75
|
0
|
|
|
|
|
0
|
close $in;
|
76
|
0
|
|
|
|
|
0
|
$data;
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub AUTOLOAD : lvalue {
|
80
|
36
|
|
|
36
|
|
3291
|
(my $name = $AUTOLOAD) =~ s/^.+:://;
|
81
|
36
|
|
|
|
|
66
|
my $self = shift;
|
82
|
36
|
|
|
|
|
40
|
my $lvalue;
|
83
|
36
|
50
|
|
|
|
74
|
if (exists $self->{$name}) {
|
84
|
36
|
|
|
|
|
60
|
$lvalue = \($self->{$name});
|
85
|
|
|
|
|
|
|
} else {
|
86
|
0
|
|
|
|
|
0
|
eval {
|
87
|
0
|
|
|
|
|
0
|
$lvalue = \($self->{$default_property}->$name);
|
88
|
|
|
|
|
|
|
};
|
89
|
0
|
0
|
|
|
|
0
|
croak "Unknown method or property '$name': $@" if $@;
|
90
|
|
|
|
|
|
|
}
|
91
|
36
|
|
|
|
|
167
|
$$lvalue;
|
92
|
|
|
|
|
|
|
}
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub DESTROY {
|
95
|
24
|
|
|
24
|
|
37
|
my $self = shift;
|
96
|
24
|
|
|
|
|
51
|
for my $k (keys %$self) {
|
97
|
144
|
|
|
|
|
174
|
undef $self->{$k};
|
98
|
144
|
|
|
|
|
195
|
delete $self->{$k};
|
99
|
|
|
|
|
|
|
}
|
100
|
24
|
|
|
|
|
205
|
undef $self;
|
101
|
|
|
|
|
|
|
}
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1;
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__
|