Thanks for the responces...
I am trying to maintain the depatch table at this time, as it is integrated into the main program preety heavly. If there is a better way to do it with out loosing the dynamic option, then that most likely would work. I considered using inheritance etc but it didn't work right for the option.
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.
--
Even smart people are dumb in most things...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.