line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Submodules::Result;
|
2
|
2
|
|
|
2
|
|
15
|
use File::Spec;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
49
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict;
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
40
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings;
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
49
|
|
5
|
2
|
|
|
2
|
|
10
|
use Carp;
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
193
|
|
6
|
|
|
|
|
|
|
use overload (
|
7
|
2
|
|
|
|
|
17
|
fallback => 1,
|
8
|
|
|
|
|
|
|
'""' => 'SCALAR',
|
9
|
2
|
|
|
2
|
|
5593
|
);
|
|
2
|
|
|
|
|
3302
|
|
10
|
|
|
|
|
|
|
our $AUTOLOAD;
|
11
|
|
|
|
|
|
|
our $VERSION = '1.0006';
|
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
|
126
|
50
|
|
126
|
|
7473
|
return &$SCALAR(@_) if 'CODE' eq ref $SCALAR;
|
28
|
|
|
|
|
|
|
}
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new {
|
31
|
24
|
|
|
24
|
1
|
31
|
my $class = shift;
|
32
|
24
|
|
|
|
|
187
|
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
|
15
|
my $self = shift;
|
45
|
12
|
|
|
|
|
73
|
my @call = caller(0);
|
46
|
12
|
|
|
|
|
21
|
my $r = eval {
|
47
|
12
|
|
|
|
|
2119
|
require "$self->{Path}";
|
48
|
|
|
|
|
|
|
};
|
49
|
12
|
50
|
|
|
|
804
|
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
|
|
|
|
|
47
|
$r;
|
58
|
|
|
|
|
|
|
}
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub use {
|
61
|
6
|
|
|
6
|
1
|
8
|
my $self = shift;
|
62
|
6
|
|
|
|
|
13
|
$self->require;
|
63
|
6
|
50
|
|
|
|
28
|
if (my $import = $self->Module->can('import')) {
|
64
|
6
|
|
|
|
|
26
|
unshift @_, $self->Module;
|
65
|
6
|
|
|
|
|
20
|
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
|
|
2217
|
(my $name = $AUTOLOAD) =~ s/^.+:://;
|
81
|
36
|
|
|
|
|
55
|
my $self = shift;
|
82
|
36
|
|
|
|
|
37
|
my $lvalue;
|
83
|
36
|
50
|
|
|
|
77
|
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
|
|
|
|
|
228
|
$$lvalue;
|
92
|
|
|
|
|
|
|
}
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1;
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__
|