--- Chris Share <[EMAIL PROTECTED]> wrote:

> Thanks for the info. Isn't this what the Perl
> Package Manager is for?
> 
> Rob Dixon wrote:
> > Chris Share wrote:
> > 
> >> I'm trying to implement the following code:
> >>
> >>
>
######################################################
> >>
> >> require LWP::UserAgent;
> >>
> >>  my $ua = LWP::UserAgent->new;
> >>  $ua->timeout(10);
> >>  $ua->env_proxy;
> >>
> >>  my $response =
> $ua->get('http://search.cpan.org/');
> >>
> >>  if ($response->is_success) {
> >>      print $response->content;  # or whatever
> >>  }
> >>  else {
> >>      die $response->status_line;
> >>  }
> >>
> >>
>
######################################################
> >>
> >> The code works but what I don't get is how do I
> know if LWP::UserAgent 
> >> (or even LWP) is installed on my machine.
> >>
> >> If I use the Perl Package Manager and type: query
> LWP
> >> I get the following:
> >>
> >> Querying target 1 (ActivePerl 5.8.7.815)
> >>   1. LWP-UserAgent-Determined [1.03] a virtual
> browser that retries 
> >> errors
> >>
> >> This is a module (?) I installed myself.
> >>
> >> Is LWP::UserAgent installed--I guess it must be
> because the code works.
> >>
> >> Can someone explain this?
> > 
> > 
> > First of all it should be
> > 
> > use LWP;
> > 
> > which does the 'require LWP::UserAgent' for you as
> well as checking that 
> > you're
> > running on an adequate version of Perl and setting
> the LWP version number.
> > 
> > And you can find out whether LWP is installed by
> entering
> > 
> > perl -MLWP -e"1"
> > 
> > on the command line. It will shout if the module
> isn't there. Your 
> > program will
> > also die at the require if it doesn't find
> LWP::UserAgent, saying 
> > something like
> > 'Can't locate LWP/UserAgent.pm in @INC'.
> > 
> > HTH,
> > 
> > Rob


yes but try pmtools.  It is a module that will give
you various info about what modules are installed and
where they live and what versions to name a few.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Reply via email to