The usual way to have several implementations of a function is to place them in a package namespace. If the modules furnish an object constructor, calling the runonce() method will automatically select the correct one.
To call a non-method runonce() from a package, use the fully-qualified name,
To call once for each package loaded, you'll need to go through all the loaded packages and try each. Here's an unsophisticated way to do it,Package::Name::runonce();
The eval is used to trap fatal errors from packages which don't define runonce().for (keys %INC) { s!/!::!g; s/\.pm$//; eval { $_::runonce() }; }
After Compline,
Zaxo
In reply to Re: Same function multiples unknown modules
by Zaxo
in thread Same function multiples unknown modules
by Delusional
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |