=head1 NAME Template::Plugin::Stash - expose the stash, ideal for Iing... =head1 SYNOPSIS [% USE Stash %] [% USE Dumper Indent = 1%]
[% Dumper.dump_html( Stash.stash() ) %]
=head1 DESCRIPTION Instead of messing with C<< [% PERL %] >> blocks to get at the stash, simply C<< [% USE Stash %] >>. Output will look something like $VAR1 = { 'global' => {}, 'var1' => 6666666, 'var2' => { 'e' => 'f', 'g' => 'h', 'a' => 'b', 'c' => 'd' }, }; which should be all you need. =head1 SEE ALSO L, L. =head1 BUGS/SUGGESTIONS/ETC To report bugs/suggestions/etc, go to Ehttp://rt.cpan.org/NoAuth/Bugs.html?Dist=Template-Plugin-StashE or send mail to Ebug-Template-Plugin-Stash#rt.cpan.orgE. =head1 LICENSE Copyright (c) 2003-2004 by D.H. (PodMaster). All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license. =cut package Template::Plugin::Stash; use strict; use base qw[ Template::Plugin ]; use vars '$VERSION'; $VERSION = sprintf "%d.%03d", q$Revision: 1.6 $ =~ /(\d+).(\d+)/g; sub new { my( $class, $con ) = @_; return bless { _CONTEXT => $con }, $class; } sub stash { my $self = shift; my $stash = { %{ $self->{_CONTEXT}->stash() } }; # do clone as Template::Stash does it delete $stash->{$_} for qw[ template dec inc component Stash ], grep { /^_/ } keys %$stash; for my $k( keys %$stash ){ delete $stash->{$k} if ref($stash->{$k}) =~ /^\QTemplate::Plugin/; } return $stash; } 1;