Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re^2: using a variable to specify which perl module to use (bareword)

by broquaint (Abbot)
on Jul 15, 2003 at 21:51 UTC ( [id://274600]=note: print w/replies, xml ) Need Help??


in reply to Re^2: using a variable to specify which perl module to use (bareword)
in thread using a variable to specify which perl module to use

require "Text::CSV" is much different than require Text::CSV
Ah yes, of course. I've written code to do the appropriate munging of a bareword many times, don't know why I forgot it this time. Anyhow my code should really look like this
BEGIN { (my $file = ($module = somecond() ? "Text::CSV" : "Text::CSV_XS")".pm") =~ s{::}(/)g; require $file; $module->import; }

HTH

_________
broquaint

  • Comment on Re: Re^2: using a variable to specify which perl module to use (bareword)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://274600]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-23 07:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found