Dear Chas,

There is one last case, but it doesn't involve loading A or B, it
involves loading A if it is available and setting a flag as to whether
it is available or not.  For example, I once wrote a Gtk based SQL
Editor/Runner.  It had the ability to save the result sets to
Microsoft Excel files, but not everyone on the team had
Spreadsheet::WriteExcel installed, so I had to add a hack** like this
to the code

In my case (just in the case somebody wants to know :) I'm working on a program that when invoked in the command line launch a Gtk2-based GUI (this is the usual mode of operation). However, the program also has a "batch" mode (for users than don't have a X environment available, like the one that access to the machine where the program executes through SSH and don't want or are unable to export the X environment). So I need conditional module loading: the Gtk2 module only has to be loaded when the GUI is going to be launched (loading Gtk2 in batch mode causes the program to fail, because of the lack of X server).

So, using require+import instead of use (as suggested in the list) resolves my issue.

Best regards,

--------------------
Fermín Galán Márquez
CTTC - Centre Tecnològic de Telecomunicacions de Catalunya
Parc Mediterrani de la Tecnologia, Av. del Canal Olímpic s/n, 08860
Castelldefels, Spain
Room 1.02
Tel : +34 93 645 29 12
Fax : +34 93 645 29 01
Email address: fermin dot galan at cttc dot es

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to