From: <pdu...@so...> - 2004-05-13 20:43:42
|
Hi Boris, On Thu, May 13, 2004 at 08:40:05PM +0200, Boris Zentner wrote: > > Hi Pieter, > > this is not a bug, $default_code_perl_sub should be called before the page_sub > itself. I agree: "$default_code_perl_sub should be called before the page_sub itself", and my fix would have violated this. What I'm trying to avoid is the case of where $default_code_perl_sub and page_sub are exactly the same function. In this case, the same function is called twice, and this should not happen. Like I said, the first fix is wrong, but how about this one: $default_code_perl_sub = undef unless (defined &$default_code_perl_sub); my @subs = ($pk->page_sub); if (defined($default_code_perl_sub) && $default_code_perl_sub ne $pk->page_sub) { unshift(@subs, $default_code_perl_sub); } return $pk->call_model_code(@subs) if (@subs); cu -- Pieter > > Look here: http://pagekit.org/guide/re15.html > > Am Donnerstag, 13. Mai 2004 19:38 schrieb pdu...@so...: > > Hi, > > > > Please take a look at line 968 of PageKit.pm: > > > > 966: $default_code_perl_sub = undef unless (defined > > &$default_code_perl_sub); > > > > 967: > > > 968: my @subs = grep { $_ } ( $default_code_perl_sub, $pk->page_sub ); > > > > 969: return $pk->call_model_code(@subs) if (@subs); > > > > Spotted it? ;-) > > > > Here's the bug described in <perl> > > if ($default_code_perl_sub eg $pk->page_sub) { > > > > # @subs == ($default_code_perl_sub, $default_code_perl_sub), > > # which means the model code for $default_code_perl_sub will be > > # run twice! > > > > } > > </perl> > > > > I suggest changing line 968 to: > > > > 968: my @subs = grep { $_ } ( $pk->page_sub ) || ( $default_code_perl_sub > > ); > > > > This bug is potentially quite nasty, if some of the > > following is done in the default code: > > - state keeping > > - logging > > - db-write actions like updates, inserts and deletes. > > > > cu > > -- > > Pieter > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: SourceForge.net Broadband > > Sign-up now for SourceForge Broadband and get the fastest > > 6.0/768 connection for only $19.95/mo for the first 3 months! > > http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click > > _______________________________________________ > > Pagekit-devel mailing list > > Pag...@li... > > https://lists.sourceforge.net/lists/listinfo/pagekit-devel > > -- > Boris > > > ------------------------------------------------------- > This SF.Net email is sponsored by: SourceForge.net Broadband > Sign-up now for SourceForge Broadband and get the fastest > 6.0/768 connection for only $19.95/mo for the first 3 months! > http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click > _______________________________________________ > Pagekit-devel mailing list > Pag...@li... > https://lists.sourceforge.net/lists/listinfo/pagekit-devel |