in reply to runtime "use" statements via string eval
If it weren't for the string eval, I'd definitively say that you're not gaining anything on memory use -- if the subroutine is ever called -- as the eval() takes on the package context of the surrounding code. Any exported variables or methods will be installed in the current package table, as far as I understand it.
Granted, if the module has already been used, Perl will look in %INC to see if it's there. You'll still have to pay the (however slight) eval string penalty.
Besides all that, it's *generally* unclear and bad style, in my opinion. Unless there's a very compelling reason to do this, I'd whack somebody who suggested it. In general, there aren't many good reasons to use eval string.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 2: runtime "use" statements via string eval
by tilly (Archbishop) on Apr 04, 2001 at 17:42 UTC |