LWP module part of the standard distribution ?

2008-08-09 Thread Tobias Eichner
I wonder if the LWP module is part of the standard distribution of Perl or not 
? According the list provided by Module::CoreList it isn't (tested versions 
5.006, 5.008 and 5.010), but it seems that it is widely spread nevertheless.

Can I rely upon LWP.pm being available on all web server (CGI) implementations 
of Perl ?

If not, is it possible to provide the LWP module together with the script 
itself or does it need to be compiled ? Or are there alternatives being usable ?

Thank you for your insights :-)


__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen 
Massenmails. 
http://mail.yahoo.com

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




Mechanize Redirect

2008-08-09 Thread Merdinus
Have seen this issue addressed on this board in the past, but can't
figure out exactly what I need to do.

I'm using WWW::Mechanize and a webpage seems to be redirecting me but
Mechanize doesn't seem to follow it.  I've heard to Add the header
'Accept: text/html' but alas I don't know how to add the header, or
what that means.

Any to save my sanity would all kinds of appreciated.


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




Re: Mechanize Redirect

2008-08-09 Thread Jeff Pang
Merdinus 写道:

 I'm using WWW::Mechanize and a webpage seems to be redirecting me but
 Mechanize doesn't seem to follow it.  I've heard to Add the header
 'Accept: text/html' but alas I don't know how to add the header, or
 what that means.
 

Hi,

The $mech-request() method will process redirects and authentication
responses transparently. You may see also $mech-redirect_ok() method.

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




Re: LWP module part of the standard distribution ?

2008-08-09 Thread Jeff Pang
Tobias Eichner 写道:
 I wonder if the LWP module is part of the standard distribution of Perl or 
 not ? According the list provided by Module::CoreList it isn't (tested 
 versions 5.006, 5.008 and 5.010), but it seems that it is widely spread 
 nevertheless.
 
 Can I rely upon LWP.pm being available on all web server (CGI) 
 implementations of Perl ?
 

I don't think you can.
From my experience, the default installtion of Perl after version 5.8.0
on many kinds of Linux has LWP installed. But Perl 5.6.x doesn't seem to
have LWP installed by default.


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




Re: Mechanize Redirect

2008-08-09 Thread Rob Dixon
Merdinus wrote:

 Have seen this issue addressed on this board in the past, but can't
 figure out exactly what I need to do.
 
 I'm using WWW::Mechanize and a webpage seems to be redirecting me but
 Mechanize doesn't seem to follow it.  I've heard to Add the header
 'Accept: text/html' but alas I don't know how to add the header, or
 what that means.
 
 Any to save my sanity would all kinds of appreciated.

If the redirect is being done with JavaScript then WWW::Mechanize will ignore
it, otherwise any GET, HEAD or POST request will be redirected as normal.

Can you give us more information on which URL it is that is being redirected?
What status code are you getting from the initial GET?

Rob

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




Re: LWP module part of the standard distribution ?

2008-08-09 Thread Rob Dixon
Tobias Eichner wrote:

 I wonder if the LWP module is part of the standard distribution of Perl or 
 not? According the list provided by Module::CoreList it isn't (tested
 versions 5.006, 5.008 and 5.010), but it seems that it is widely spread
 nevertheless.
 
 Can I rely upon LWP.pm being available on all web server (CGI)
 implementations of Perl ?
 
 If not, is it possible to provide the LWP module together with the script
 itself or does it need to be compiled ? Or are there alternatives being 
 usable ?

LWP is not amongst the Standard Modules. (There is a list of Standard Modules in
perldoc perlmodlib.) However it would be unusual to find it unavailable on an
installation of Perl intended for running CGI scripts, and being Perl-only I
believe it should be a simple matter to install it if you find it missing.

You may find more comprehensive help on the [EMAIL PROTECTED] list.

HTH,

Rob

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




Break out of the sub or loop on keypress

2008-08-09 Thread Michael Alipio
Hi,

I have a sub that returns a value and inside it runs a loop that displays 
something on the screen, say a list of numbered items. Now what I want to do is 
if the item i'm interested appears on the screen, the user can hit any key and 
the program will exit the sub and return what ever it is supposed to return.

Any idea how to accomplish that?


  

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




Re: Break out of the sub or loop on keypress

2008-08-09 Thread Mr. Shawn H. Corey
On Sat, 2008-08-09 at 14:42 -0700, Michael Alipio wrote:
 Hi,
 
 I have a sub that returns a value and inside it runs a loop that displays 
 something on the screen, say a list of numbered items. Now what I want to do 
 is if the item i'm interested appears on the screen, the user can hit any key 
 and the program will exit the sub and return what ever it is supposed to 
 return.
 
 Any idea how to accomplish that?
 
 
   
 
Yes.  Fork of a child process, use Term::ReadKey to set STDIN to respond
immediately on key press.  When that happens, the child process signals
the parent, which breaks the loop.

See:
perldoc perlipc
perldoc Term::ReadKey


-- 
Just my 0.0002 million dollars worth,
  Shawn

Where there's duct tape, there's hope.

Perl is the duct tape of the Internet.
Hassan Schroeder, Sun's first webmaster


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




Re: Break out of the sub or loop on keypress

2008-08-09 Thread Rob Dixon
Michael Alipio wrote:
 
 I have a sub that returns a value and inside it runs a loop that displays 
 something on the screen, say a list of numbered items. Now what I want to do
 is if the item i'm interested appears on the screen, the user can hit any key
 and the program will exit the sub and return what ever it is supposed to
 return.
 
 Any idea how to accomplish that?

I'm not clear if the what ever it is supposed to return is related to the key
press or not. If not then perhaps the subroutine should be broken into two.

Anyway, it sounds like what you want to do is to break out of a loop when a key
is pressed. The program below prints dots until a key is pressed and then says
how many have been printed. Does that help?

Rob


use strict;
use warnings;

use Term::ReadKey;

my $n = 0;

while () {
  print '.';
  last if ReadKey(-1);
  $n++;
}

print $n;


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




Re: Mechanize Redirect

2008-08-09 Thread Merdinus
On Aug 9, 9:30 am, [EMAIL PROTECTED] (Rob Dixon) wrote:
 Merdinus wrote:

  Have seen this issue addressed on this board in the past, but can't
  figure out exactly what I need to do.

  I'm using WWW::Mechanize and a webpage seems to be redirecting me but
  Mechanize doesn't seem to follow it.  I've heard to Add the header
  'Accept: text/html' but alas I don't know how to add the header, or
  what that means.

  Any to save my sanity would all kinds of appreciated.

 If the redirect is being done with JavaScript then WWW::Mechanize will ignore
 it, otherwise any GET, HEAD or POST request will be redirected as normal.

 Can you give us more information on which URL it is that is being redirected?
 What status code are you getting from the initial GET?

 Rob

Thanks for the replies.  The redirect is happening after a $mech-
submit_form(...)

The webpage is at:  http://patft.uspto.gov/netahtml/PTO/srchnum.htm
The submit form is submitting all the hidden variables in the webpage
as well as a 7 digit number for a patent (ex. 7123456).  To gather
info, after the call to submit_form I've edited the code to I've
printed $mech-uri() to a file.  I then copied and pasted that string
into a browser and the browser (IE7) happily gets redirected on, so it
seems that submit_form is bringing me from the start webpage to the
middle webpage, but then it's not carrying me on to the final
webpage.

I could have sworn I've tried the $mech-redirect_ok() and got an
error - some error deep in the code (i.e. below my code and in the
perl code underneath).  But maybe I did it wrong, who knows.  Sorry I
can't be more specific about this attempt, the code I put together is
at work and I can't access it.  Tomorrow (Sunday the 10th) I'll try to
rewrite all the code on this computer for debugging - shouldn't be too
hard, there wasn't much.

Final piece of info:  I downloaded my perl executable from ActiveState
(sometime last week, and I downloaded the most recent version
available) - if that info means anything of importance.

Thanks again for the replies and any help is much appreciated.


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