in reply to Using the perl modules depends upon the availability of another module.
It would be use Module1 || use Module2, but that doesn't work because use dies on failure. You might try to wrap the use in an eval BLOCK, but that doesn't work because of compile-time vs run-time issues. You could succeed, however, by following the advice given in "use" dynamic module. Alternativly, eval EXPR does the trick:
# Approximate # use Module1 || use Module2; BEGIN { eval qq{ use Module1 }; eval qq{ use Module2 } if not $@; die("Unable to load Module1 or Module2\n" if not $@; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using the perl modules depends upon the availability of another module.
by PodMaster (Abbot) on Dec 08, 2005 at 08:15 UTC | |
by ikegami (Patriarch) on Dec 08, 2005 at 15:02 UTC |
In Section
Seekers of Perl Wisdom