From: Boris Z. <bz...@2b...> - 2004-05-13 23:07:27
|
Hi Pieter, Am Donnerstag, 13. Mai 2004 22:43 schrieb pdu...@so...: > 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. I see that, but this can only happen if you call http://your_site.xy/xxx/pkit_default and if so it might be your intent since you must prepare pkit_default to serve something on its own, it must have a *.tmpl or you get a error anyway. > 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); Sometimes we do not have a page_sub. Then we end with @subs = ( undef ) but scalar(@subs) == 1 which makes call_model_code() unhappy. I suggest this ( untested ): Index: PageKit.pm =================================================================== --- PageKit.pm (revision 127) +++ PageKit.pm (working copy) @@ -999,6 +999,9 @@ my $pk = shift; my $page_id = shift || $pk->{page_id}; + return if $page_id =~ /pkit_default$/; + # change all the / to :: $page_id =~ s!/!::!g; > 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 > > [...] -- Boris |