How can I conditionally use a module?
I have a script that I wish to run on Linux and Windows (activestate
5.8.8).
Under windows it will produce an xl spreadsheet and a comma-separated
text file.
I haven't found an xl module for Linux so I will simple omit that
function and produce only the CSV.
The problem is to stop Linux complaining about:
use Spreadsheet::WriteExcel;

I have tried using eval but cant hide it on Linux.
E.G.
BEGIN {
        $LINUX = ($^O eq "MSWin32") ? 0: 1;
        unless ($LINUX)
        {
         my $string='use Spreadsheet::WriteExcel;';
        eval { $string};
        }
      }


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to