See mst note below. Worked for me.

On Mar 2, 2011, at 12:12 PM, Chakkit Ngamsom wrote:

> Hi All,
>  
> My plan is to use Catalyst::Plugin::RunAfterRequest for sending email via 
> Catalyst::View::Email as the background.
> Due to sometimes mail server got lag and the page waiting for it or sending a 
> notification after slow processes have been completed e.g. import/export.
>  
> I’m not sure it’s a bug or the limitation of the plugin.
> I setup the code something like this:
>  
> $c->run_after_request(
>   sub {
>     $c->stash->{email} = {
>       from => $from,
>       to => $to,
>       body => $body,
>       header => [
>         Subject => 'some localized subject',
>       ],
>     };
>     $c->forward( $c->view('Email') );
>   }
> );
>  
> After running it, it showed an error like this:
> [error] Caught exception in engine "Modification of non-creatable array value 
> attempted, subscript -1 at C:/strawberry/perl/site/lib/Catalyst/Dispatcher.pm 
> line 278."
>  
> As a trial, the error caused from this line: $c->forward( $c->view('Email') 
> );.
> Finally, I noticed it worked well with other forwarding except view.
>  
> Please kindly let me know how to fix this issue or another solution that 
> matches to the requirements.
>  
> Thanks in advance,
> Chakkit
> 






Begin forwarded message:

> From: Matt S Trout <[email protected]>
> Date: May 2, 2010 12:49:32 PM PDT
> To: The elegant MVC web framework <[email protected]>
> Subject: Re: [Catalyst] RunAfterRequest/delayed Catalyst view
> Reply-To: The elegant MVC web framework <[email protected]>
> 
> On Fri, Apr 30, 2010 at 02:38:50PM -0700, Steve Kleiman wrote:
>> Here goes...hopefully a simple test case for the RunAfterRequest oddness.
> 
>> The code below with the forward INSIDE 'run_after_request' subroutine throws 
>> the error:
>>> [error] Caught exception in engine "Modification of non-creatable array 
>>> value attempted, subscript -1 at 
>>> /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Dispatcher.pm line 278."
> 
> I think that's probably $c->stack being empty because there's no request
> anymore.
> 
> I *think* that
> 
> $c->view('Email')->process($c);
> 
> would work, since that doesn't rely on the action call stack.
> 
> That error message is fucking awful though, and almost certainly my fault.
> 
> Proposal: first you try the ->process-by-hand approach to confirm that I'm
> an idiot the way I think I am. Second we discuss how to either (a) fix this
> or (b) make sure it produces a non-awful error.
> 
> (even if you've already rewritten the code it'd be much appreciated if you
> could try this out and see if it does the right thing - also, you then get to
> point and laugh at me with a bit of luck, which may or may not be an added
> incentive ;)
> 
> -- 
> Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a 
> clue
> 
> http://shadowcat.co.uk/blog/matt-s-trout/   http://twitter.com/shadowcat_mst/
> 
> Email me now on mst (at) shadowcat.co.uk and let's chat about how our Catalyst
> commercial support, training and consultancy packages could help your team.
> 
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/



_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to