Darin McBride <[EMAIL PROTECTED]> wrote on Wed, Apr 16, 2008 at 10:38:19AM 
-0600:
> My suggestion is that AUTOLOAD is not, and never has been, a runmode.  No one 
> should be able to load http://myapp.net/?rm=AUTOLOAD.  I've not tested to see 
> if that actually calls the AUTOLOAD runmode or not, but it shouldn't.  (I 
> suspect it does.)

I agree that AUTOLOAD shouldn't be treated as a runmode. And yes, loading
http://myapp.net/?rm=AUTOLOAD does call the AUTOLOAD runmode. The sub gets
called with an undefined value for its second argument.

> Instead, if I want the fallback, I should not be setting a run_mode, I should 
> be setting a fallback:
> 
>             $self->fallback_mode('my_catchall_sub');
>
> This is something that should be callable only in cases where the fallback is 
> required.

I think this is an excellent solution. Thanks for the patch. I did have one
problem with it, though. I got a syntax error on this line (in Perl 5.8.8):

  return $self->{__FALLBACK_MODE} || {$self->run_modes()}{AUTOLOAD};

Just to get it running, I changed it to this (though I'm guessing there's a
slicker way):

  if ($self->{__FALLBACK_MODE}) {
    return $self->{__FALLBACK_MODE};
  }
  else {
    my %rmodes = ($self->run_modes());
    return $rmodes{AUTOLOAD};
  }

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to