| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Template::Plugin::Stash - expose the stash, ideal for Iing... |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
[% USE Stash %]
|
|
8
|
|
|
|
|
|
|
[% USE Dumper Indent = 1%] |
|
9
|
|
|
|
|
|
|
[% Dumper.dump_html( Stash.stash() ) %] |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Instead of messing with C<< [% PERL %] >> blocks |
|
14
|
|
|
|
|
|
|
to get at the stash, simply C<< [% USE Stash %] >>. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Output will look something like |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$VAR1 = {
|
|
19
|
|
|
|
|
|
|
'global' => {},
|
|
20
|
|
|
|
|
|
|
'var1' => 6666666,
|
|
21
|
|
|
|
|
|
|
'var2' => {
|
|
22
|
|
|
|
|
|
|
'e' => 'f',
|
|
23
|
|
|
|
|
|
|
'g' => 'h',
|
|
24
|
|
|
|
|
|
|
'a' => 'b',
|
|
25
|
|
|
|
|
|
|
'c' => 'd'
|
|
26
|
|
|
|
|
|
|
},
|
|
27
|
|
|
|
|
|
|
};
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
which should be all you need. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
L, |
|
34
|
|
|
|
|
|
|
L. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 BUGS/SUGGESTIONS/ETC
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
To report bugs/suggestions/etc, go to
|
|
39
|
|
|
|
|
|
|
Ehttp://rt.cpan.org/NoAuth/Bugs.html?Dist=Template-Plugin-StashE
|
|
40
|
|
|
|
|
|
|
or send mail to Ebug-Template-Plugin-Stash#rt.cpan.orgE. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 LICENSE |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Copyright (c) 2003-2004 by D.H. (PodMaster). All rights reserved.
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it
|
|
47
|
|
|
|
|
|
|
under the same terms as Perl itself. The LICENSE file contains the full
|
|
48
|
|
|
|
|
|
|
text of the license.
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
package Template::Plugin::Stash; |
|
53
|
1
|
|
|
1
|
|
24069
|
use strict;
|
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
45
|
|
|
54
|
1
|
|
|
1
|
|
5
|
use base qw[ Template::Plugin ];
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1177
|
|
|
55
|
1
|
|
|
1
|
|
8006
|
use vars '$VERSION'; |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
339
|
|
|
56
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%03d", q$Revision: 1.6 $ =~ /(\d+).(\d+)/g; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
|
60
|
0
|
|
|
0
|
1
|
|
my( $class, $con ) = @_; |
|
61
|
0
|
|
|
|
|
|
return bless { _CONTEXT => $con }, $class; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub stash { |
|
65
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
66
|
0
|
|
|
|
|
|
my $stash = { %{ $self->{_CONTEXT}->stash() } }; # do clone as Template::Stash does it |
|
|
0
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
delete $stash->{$_} |
|
69
|
0
|
|
|
|
|
|
for |
|
70
|
|
|
|
|
|
|
qw[ template dec inc component Stash ], |
|
71
|
|
|
|
|
|
|
grep { /^_/ } keys %$stash; |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
for my $k( keys %$stash ){ |
|
74
|
0
|
0
|
|
|
|
|
delete $stash->{$k} if ref($stash->{$k}) =~ /^\QTemplate::Plugin/; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
return $stash; |
|
78
|
|
|
|
|
|
|
}
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |