Package names are just strings, so I would approach the problem as follows:
use vars qw($csv_class); if( $i_want_to_use_XS ) { require Text::CSV_XS; $csv_class= 'Text::CSV_XS'; } else { require Text::CSV; $csv_class= 'Text::CSV'; }; my $csv= $csv_class->new(...);
In reply to Re: Switching Modules as Necessary
by Corion
in thread Switching Modules as Necessary
by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |