kaif has asked for the wisdom of the Perl Monks concerning the following question:
I am planning on writing a Perl script that will be run on a variety of different platforms and Perl installations (both version numbers and module configurations). Because sometimes I can not or do not wish to control the installation and because some things work on Unix-type machines but do not on Windows, I would like to write my program so that it chooses which module or code to use for a particular task. So, I have two general questions:
How does a module such as CPAN test whether or not the user has Net::FTP or LWP, etc., installed and working? I tried looking through the code, but could not find the answer. In general, what methods should I use to determine whether or not I can use module Foo::Bar? Are there methods preferred to liberal use of eval? Also, I am considering not only checking whether or not a module is available but also running some (of my own) test cases against it. Is this a good idea and does anyone have any experience with this? (That is, running test cases and reacting to them within a single program.)
Secondly, I'd like for the program to check for module availability on its first run and then simply proceed to use what it determined was usable (as the first run may take a while). However, perhaps when a new module is installed or something, I would like to rerun the configuration procedure. Is there a configuration module that would help me here? How should I store the data of "this module works but this one doesn't" and then use it when necessary?
I tried searching Perlmonks but could not find anything. Thanks very much in advance for your assistance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Gracefully choosing which module to use
by samtregar (Abbot) on Jun 13, 2005 at 17:32 UTC | |
|
Re: Gracefully choosing which module to use
by nothingmuch (Priest) on Jun 13, 2005 at 17:57 UTC | |
by gaal (Parson) on Jun 13, 2005 at 20:22 UTC | |
by nothingmuch (Priest) on Jun 14, 2005 at 10:55 UTC | |
by gaal (Parson) on Jun 14, 2005 at 11:03 UTC | |
by nothingmuch (Priest) on Jun 14, 2005 at 14:38 UTC | |
| |
|
Re: Gracefully choosing which module to use
by scmason (Monk) on Jun 13, 2005 at 17:38 UTC | |
|
Re: Gracefully choosing which module to use
by sgifford (Prior) on Jun 13, 2005 at 22:00 UTC | |
|
Re: Gracefully choosing which module to use
by ChrisS (Monk) on Jun 14, 2005 at 16:57 UTC |