Question about Installed Packages

2006-10-20 Thread Chris Share

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?

Cheers,

Chris



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Question about Installed Packages

2006-10-20 Thread Rob Dixon

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


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Question about Installed Packages

2006-10-20 Thread Chris Share

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




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Question about Installed Packages

2006-10-20 Thread Derek B. Smith

--- 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]
 




Re: Question about Installed Packages

2006-10-20 Thread Rob Dixon

Chris Share wrote:

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'.

>
> Thanks for the info. Isn't this what the Perl Package Manager is for?


Hi Chris. Please bottom-post your replies. Thanks.

Perl Package Manager is an ActiveState utility that will tell you only what
packages it remembers installing itself. It won't tell you about anything that
you've installed with CPAN or even anything that was installed with Perl itself,
like List::Utils. And if it has been used to install a package which has since
been damaged or deleted behind its back it will happily tell you that it;s still
there. Using Perl itself to try to load the module as I described is the best
test.

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]