[Catalyst-dev] Proposal for new module: Catalyst::Plugin::Memory
Peter Karman
peter at peknet.com
Wed Oct 8 14:28:39 BST 2008
Simon Bertrang wrote on 10/08/2008 07:28 AM:
> Hi,
> i need a way to save various kinds of information between different
> points in the request chain.
> Initially i abused the stash for this, but polluting the template with
> data not needed there or even worse, preventing things to work as
> expected, did not work out.
> The session would have been another solution but the same arguments
> apply there as for the templates.
>
> What was left:
> a) accessing $c manually to hand over the data
> b) implement a controller providing a common method
> c) writing a plugin
>
what about (d) ?
package MyApp;
sub mystuff {
my ($c, %newstuff) = @_;
my $stuff = $c->stash->{_my_stuff};
$stuff->{$_} = $newstuff{$_} for keys %newstuff;
return $stuff;
}
I find just having a reserved stash key for things I want to pass around
but not necessarily pollute my template with works pretty well.
--
Peter Karman . peter at peknet.com . http://peknet.com/
More information about the Catalyst-dev
mailing list