in reply to Re: Old Code reference wants new life as Object.
in thread Old Code reference wants new life as Object.
Right now each of the existing plugin's have a load section which loads a code reference into a global dispatch hash:
$dispatch{login} = \&login;
$dispatch{slogin} = \&secure_login;
The script then uses a value of a specific varible to determin what to do.
$dispatch{default} = \&show_option_menu; #if nothing else we will show the menu
$dispatch->{$dothis_now}->() # does the code ref.
Now as you can tell, doing a code ref with \&login for example will work. It will not run the code when loaded into the hash, and waits nicely until it is wanted.
$dispatch{self_test} = $self->login;
Will execute the code before it is placed in the hash.
I have not yet tested the other options given, but will as soon as I'm next to my development machine. But hopefully this clears it up a bit.
It may be both the calling and the plugin code need to be 'fixed' to work properly.
--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Old Code reference wants new life as Object.
by revdiablo (Prior) on Dec 08, 2006 at 23:11 UTC |