[cgiapp] can AUTOLOAD sub be named AUTOLOAD?

Rhesa Rozendaal perl at rhesa.com
Wed Apr 16 12:46:48 EDT 2008


rjmorris12 at gmail.com wrote:
> Perrin Harkins <perrin at elem.com> wrote on Wed, Apr 16, 2008 at 09:30:48AM -0400:
>> On Tue, Apr 15, 2008 at 11:09 PM,  <rjmorris12 at gmail.com> wrote:
>>>  Am I forced to name the AUTOLOAD
>>>  method something other than AUTOLOAD?
>> Doctor, it hurts when I do this...
> 
> :)  Yes, I realize it seems somewhat trivial, but here's my rationale: If I
> must name the AUTOLOAD method something other than AUTOLOAD, then I am
> forced to use the hash version of run_modes() in setup(). Since all my
> run mode methods have the same name as the run modes themselves, I must
> enter each run mode's name twice:
> 
>   $self->run_modes(
>     "mode1" => "mode1",
>     "mode2" => "mode2",
>     "AUTOLOAD" => "catchall"
>   );
>       
> instead of:
>       
>   $self->run_modes([qw/
>     mode1
>     mode2
>     AUTOLOAD
>   /]);


You can do both:

   $self->run_modes([qw/ an array /]);
   $self->run_modes( a_single => 'named_mode' );

run_modes() is additive, so this sets up three (3) run modes.

rhesa


More information about the cgiapp mailing list