[Catalyst] Error: "You requested a stash, but one does not exist" #2

John Napiorkowski jjn1056 at yahoo.com
Wed May 20 19:27:33 GMT 2015


Hi so

my $c = MyApp->new(); 

when you do that you don't have a context, its an instance of your application.  Since Catalyst conflates the two this is a common thing to think :)  But you only get a context IF you have a request.  So $app->stash isn't going to work.

I'd be happy to take a patch to do something sorta correct in application context, but I'd rather help you not use the stash like this.  Its probably going to make sad pandas down the road.  That's half the reason I went this direction (to help move us along toward the application/context split we've talked about for years and years...)

You could fake it by giving your instance a request object.  But tell me more about the use case

Jnap



On Wednesday, May 20, 2015 6:05 AM, Bernhard Bauch <bauch at zsi.at> wrote:



Hey all,

i'm testing an update to the latest Catalyst version.
the web-application via FCGI works fine, but i do run Catalyst from command line scripts as well.

likeuse MyApp;


my $c = MyApp->new(); 


my $val = "12345";
$c->stash->{val} = $val;

my $stash = $c->stash->{val};
print "from stash: $stash\n";

since the upgrade i get the following error:

You requested a stash, but one does not exist at .....\site\lib\Catalyst.pm line 517.

As i read stash is now a middleware plugin; and is stored in the PSGI? environment; for sure thats not available when running from CLI.

how to i make the good old stash working if i'm from command line ?

thanks for support,
bernhard






—
Bernhard Bauch
Webdevelopment

ZSI-Zentrum für Soziale Innovation GmbH
Centre for Social Innovation

Linke Wienzeile 246, A-1150 Wien, Austria
Mail: bauch at zsi.at
Skype: berni-zsi




_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list