Hey Cory --

> > This, of course, sent me back under the hood! :)  It appears that
> > the only way
> > to call a method by its name (as determined at runtime) is to
> > wrap it in an
> > eval.  At least that appears to be what you do here:
> 
> Which is why we do things like ...
> 
> 'mode1' => \&show_login_form,
> 'mode2' => \&run_login,
> 'mode3' => \&show_session
> 
> right?  To avoid that additional eval call when PERL is 
> checking for the
> sub.


CGI::Application version 1.3 or later supports both sub-ref and sub-names as
values in the run-modes hash table.  Prior to 1.3 only sub-refs were
supported.

I added support for sub-names for two reasons.  First, and most importantly,
sub-refs do not abide by inheritance.  This would prevent you from creating
a new application which inherits from another application, changing some
run-mode methods.

The second reason for supporting sub-names is because not many people
understand sub-refs!  Sub-refs will be faster -- about 10-times faster if I
remember my benchmark from ages ago.  Sub-names will be a bit easier to
read, and will support inheritance.


TTYL,

-Jesse-


  Jesse Erlbaum, CTO
  Vanguard Media
  http://www.vm.com
  212.242.5317 x115
  [EMAIL PROTECTED]



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to