[cgiapp] Re: Problem with Flash, Session & persistent environment identified

Mark Stosberg mark at summersault.com
Fri Nov 21 14:11:58 EST 2008


> In CAP::ErrorPage:
> 
> sub add_page_not_found_rm {
>      my $c = shift;
> 
>       my %rms = $c->run_modes;
> 
>       unless( exists $rms{'AUTOLOAD'}) {
>           $c->run_modes(
>               AUTOLOAD => sub {
>                   return $c->error(
>                       title => 'The requested page was not found.',
>                       msg => "(The page tried was: 
> ".$c->get_current_runmode.")"
>                   )
>           });
>       }
> }
> 
> 
> In the AUTOLOAD sub I think it is making a circular reference to the 
> CGIApp object ($c) since the sub creates a closure which is stored 
> inside of $c for the runmodes.
> 
> If inside that sub reference I add 'my $c = shift;' first the problem 
> goes away, but I am not sure if that breaks the plugin at all since I do 
> not use it.

I agree that looks like a bug. Thanks for spotting and reporting it. 

> I can submit a bug report and/or patch.

Thanks, I've opened on myself:
http://rt.cpan.org/Ticket/Display.html?id=41130

I have also consider the design of autoflushing a bug in CGI::Session.  I do
not recommend relying it for precisely cases like this. Changes to third-party
modules should not alter the behavior of CGI::Session, but with autoflushig,
they can, and it's hard to track down.

As the CGI::Session docs now recommend, always explicitly flush.

I learned about the issue the hard way myself.

    Mark

-- 
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark Stosberg            Principal Developer  
   mark at summersault.com     Summersault, LLC     
   765-939-9301 ext 202     database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .




More information about the cgiapp mailing list