line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::VMethods::VMethodContainer; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
sub new |
4
|
|
|
|
|
|
|
{ |
5
|
10
|
|
|
10
|
0
|
14
|
my $class = shift; |
6
|
10
|
|
|
|
|
33
|
my $this = bless {}, $class; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# what was this thing called? |
9
|
10
|
|
|
|
|
33
|
$this->{op} = shift; |
10
|
10
|
|
|
|
|
19
|
$this->{vmethname} = shift; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# remember the stringification of the stash as an indentifier |
13
|
10
|
|
|
|
|
25
|
my $stash = shift; |
14
|
10
|
|
|
|
|
31
|
$this->{stash} = "$stash"; # stringify object ref |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# what are we replacing? |
17
|
10
|
|
|
|
|
17
|
$this->{sub} = shift; |
18
|
|
|
|
|
|
|
|
19
|
10
|
|
|
|
|
113
|
return $this; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# this function is used to work out if the passed stash is the |
23
|
|
|
|
|
|
|
# same stash that we were created in or a clone stash. It does |
24
|
|
|
|
|
|
|
# this by comparing the stringification of the ref |
25
|
|
|
|
|
|
|
sub stashmatch |
26
|
|
|
|
|
|
|
{ |
27
|
2
|
|
|
2
|
0
|
4
|
my $this = shift; |
28
|
2
|
|
|
|
|
3
|
my $stash = shift; |
29
|
2
|
|
|
|
|
17
|
return "$stash" eq $this->{stash}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub DESTROY |
33
|
|
|
|
|
|
|
{ |
34
|
10
|
|
|
10
|
|
930
|
my $this = shift; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#print STDERR "DESTROYING $this->{op} $this->{vmethname}!\n"; |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
114
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# work out where we're uninstalling to |
41
|
10
|
|
|
|
|
13
|
my $hashref = ${'Template::Stash::'.$this->{op}}; |
|
10
|
|
|
|
|
34
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# replace the vmethod with what was there before. |
44
|
10
|
100
|
|
|
|
25
|
if (defined($this->{sub})) |
45
|
4
|
|
|
|
|
36
|
{ $hashref->{ $this->{vmethname} } = $this->{sub}; } |
46
|
|
|
|
|
|
|
else |
47
|
6
|
|
|
|
|
81
|
{ delete $hashref->{ $this->{vmethname} }; } |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |