require "Text::CSV" is much different than require Text::CSVAh 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; }
_________
broquaint
In reply to Re: Re^2: using a variable to specify which perl module to use (bareword)
by broquaint
in thread using a variable to specify which perl module to use
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |