ajt has asked for the wisdom of the Perl Monks concerning the following question:
I asssume the logic Matt is using is: GHTTP is faster than LWP, but it's a lot less common, so he tries to use it first, then if that fails, he uses the more common LWP. Here is a fragment of his code:
eval { require HTTP::GHTTP; }; if ($@) { require LWP::Simple; import LWP::Simple; return get($sysid) || die "Cannot get $sysid"; } my $r = HTTP::GHTTP->new($sysid); $r->process_request; return $r->get_body;
I've implemented the same idea in some of my own scripts, and it seems to work, and GHTTP seems to be faster than LWP.
My question is, when there are several modules to use, one which is fast and rare, another that is very fast but OS specific, and one that is slow but works everywhere, is this method as used by Matt wise?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use-ing one of two or more similar modules
by tomhukins (Curate) on Oct 11, 2001 at 22:44 UTC | |
|
Re: use-ing one of two or more similar modules
by perrin (Chancellor) on Oct 12, 2001 at 01:12 UTC |