Exposing my ignorance, wanting help with use!

Luke Ross luke at lukeross.name
Wed Feb 14 14:54:11 GMT 2007


On Wed, Feb 14, 2007 at 02:30:07PM +0000, Peter Hickman wrote:
> Unfortunately my fount of all things Perl is away today and as I look 
> around the office I see that I am surrounded by Java programmers. So no 
> help there, I'll just have to expose my ignorance to the whole world.
> I have this little project I am working on that involves the following code:

>From the man pages:

If EXPR is a bareword, the require assumes a ".pm" extension
and replaces "::" with "/" in the filename for you, to  make it
easy to load standard modules.  This form of loading of modules
               does not risk altering your namespace.

Unfortunately your require does not use a bareword. You could say 
something like

$var = "$module.pm"; eval { require $var; }

or perhaps easier to follow, but less efficient

eval "require $module;"

By the time the require is hit in the second case, it appears that 
$module has become a bareword - for this reason you need to be 100% 
certain that $module is safe!


``Urghh! People keep bidding *against* me. How rude!''
  -- Luke identifies eBay's fatal flaw

More information about the london.pm mailing list