[28522] in Perl-Users-Digest
Perl-Users Digest, Issue: 9886 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 24 18:06:10 2006
Date: Tue, 24 Oct 2006 15:05:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 24 Oct 2006 Volume: 10 Number: 9886
Today's topics:
$^I FAQ entry or docs? <DJStunks@gmail.com>
Re: $^I FAQ entry or docs? <mritty@gmail.com>
Re: $^I FAQ entry or docs? <glex_no-spam@qwest-spam-no.invalid>
Re: $^I FAQ entry or docs? <DJStunks@gmail.com>
Re: ability to match / detect acronyms ? (Chris Mattern)
Re: ActiveState Perl crashs, why ? <sisyphus1@nomail.afraid.org>
Re: Automatic login to a web page <zentara@highstream.net>
Re: Automatic login to a web page <bwilkins@gmail.com>
Re: Can't find string terminator ... <softouch@softouch.on.ca>
Help with reverse order number generation <pradeep.bg@gmail.com>
Re: Help with reverse order number generation <mritty@gmail.com>
Re: Help with reverse order number generation <DJStunks@gmail.com>
Re: Help with reverse order number generation <wahab@chemie.uni-halle.de>
HTML::TokeParser; __DATA__ as a filehandle Jonathan@D4HRQQB1.i-did-not-set--mail-host-address--so-tickle-me
Re: HTML::TokeParser; __DATA__ as a filehandle <mritty@gmail.com>
Re: HTML::TokeParser; __DATA__ as a filehandle <bwilkins@gmail.com>
Re: LWP and Javascript onclick form <cacheung@consumercontact.com>
Re: Perl SOAP::Lite NTLM authentication <michelin_nospam@tin.it>
Re: Strange Perl line : Return the result of a function <someone@example.com>
use of variables news2003@wanadoo.es
Re: use of variables <mritty@gmail.com>
Re: use of variables <brian.raven@osbsl.co.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Oct 2006 11:24:54 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: $^I FAQ entry or docs?
Message-Id: <1161714294.358537.72490@b28g2000cwb.googlegroups.com>
Hey all,
I can't find that FAQ entry I know I've seen about setting $^I locally
within a larger script. Does anyone have the link to that FAQ entry,
or any docs on the topic, or a framework script in which they utilize
this feature? So far I've only done -i from the command line...
TIA,
-jp
------------------------------
Date: 24 Oct 2006 11:43:51 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: $^I FAQ entry or docs?
Message-Id: <1161715431.337854.324710@m7g2000cwm.googlegroups.com>
DJ Stunks wrote:
> I can't find that FAQ entry I know I've seen about setting $^I locally
> within a larger script. Does anyone have the link to that FAQ entry,
> or any docs on the topic, or a framework script in which they utilize
> this feature? So far I've only done -i from the command line...
$ perldoc -q -i
Found in /opt2/Perl5_8_4/lib/perl5/5.8.4/pod/perlfaq5.pod
How can I use Perl's "-i" option from within a program?
Paul Lalli
------------------------------
Date: Tue, 24 Oct 2006 13:44:54 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: $^I FAQ entry or docs?
Message-Id: <453e5eee$0$496$815e3792@news.qwest.net>
DJ Stunks wrote:
> Hey all,
>
> I can't find that FAQ entry I know I've seen about setting $^I locally
> within a larger script. Does anyone have the link to that FAQ entry,
> or any docs on the topic, or a framework script in which they utilize
> this feature? So far I've only done -i from the command line...
Look in perlfaq5
------------------------------
Date: 24 Oct 2006 11:53:38 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: $^I FAQ entry or docs?
Message-Id: <1161716018.227312.120090@m73g2000cwd.googlegroups.com>
Paul Lalli wrote:
> DJ Stunks wrote:
> > I can't find that FAQ entry I know I've seen about setting $^I locally
> > within a larger script. Does anyone have the link to that FAQ entry,
> > or any docs on the topic, or a framework script in which they utilize
> > this feature? So far I've only done -i from the command line...
>
> $ perldoc -q -i
> Found in /opt2/Perl5_8_4/lib/perl5/5.8.4/pod/perlfaq5.pod
> How can I use Perl's "-i" option from within a program?
tyvm. I can never seem to find what I want when I want it :p
-jp
------------------------------
Date: Tue, 24 Oct 2006 19:31:25 -0000
From: syscjm@sumire.eng.sun.com (Chris Mattern)
Subject: Re: ability to match / detect acronyms ?
Message-Id: <12jsqgdp9sobt72@corp.supernews.com>
In article <ehi1ih$d6l$1@nntp.fujitsu-siemens.com>, Josef Moellers wrote:
>John W. Kennedy wrote:
>> anno4000@radom.zrz.tu-berlin.de wrote:
>>
>>> Jack <jack_posemsky@yahoo.com> wrote in comp.lang.perl.misc:
>>>
>>>> Jack wrote:
>>>>
>>>>> Hi I was wondering if anyone had any code to detect / match / identify
>>>>> acronyms (AAA, BD) , essentially these are non words..besides just
>>>>> detecting the capitals of course.
>>>
>>>
>>> Some acronyms are words,
>>
>>
>> All acronyms are words, by definition.
>
>There are acronyms that
>1. you couldn't pronounce, e.g. WWW,
WWW isn't an acronym.
>2. you can pronounce (in some language) but they aren't "proper words"
>in most languages, e.g. "USA"
USA isn't an acronym.
>3. you can pronounce and they are "proper words" in at least some
>language, e.g. "ARM: Advanced RISC machine, RISC: Reduced Instruction
>Set Computer".
>
>I guess Anno was referring to 3.
>
That's because 3 is the definition of acronym, as Anno noted.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Wed, 25 Oct 2006 04:43:31 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: ActiveState Perl crashs, why ?
Message-Id: <453e5ff7$0$11971$afc38c87@news.optusnet.com.au>
"perl" <someone@somewhere.none> wrote in message
news:ehla17$nto$1@online.de...
> Hello,
>
> when i run my little perl script, Perl crashes (using Win2000+ActiveState
> Perl 5.8.8).
> I have no idea why.
>
> Here the little script:
> ---------------------------------
> #!/usr/bin/perl -w
>
> use LWP::UserAgent;
> use strict;
>
> my $url = "http://www.google.de";
> my $ua = LWP::UserAgent->new(); # create virtual browser
> $ua->agent("someagent/v 0.1a"); # giving browser a name
>
> my $req = HTTP::Request->new(GET => $url);
> my $webpage = $ua->request($req);
>
> if ($webpage->is_success){ print $webpage->content;}
> else {print $webpage->status_line, "\n";}
> -----------------------------------
>
Can't reproduce the problem. That script works fine for me using ActiveState
perl 5.8.8 (build 817) on Windows 2000.
What exactly happens when "Perl crashes" ? Do you get any error messages ?
Cheers,
Rob
------------------------------
Date: Tue, 24 Oct 2006 18:34:26 GMT
From: zentara <zentara@highstream.net>
Subject: Re: Automatic login to a web page
Message-Id: <19msj2185ojggkvb239rnblcant4lvjqsq@4ax.com>
On 23 Oct 2006 23:32:29 -0700, "Jagjeet_Singh" <jagjeet.malhi@gmail.com>
wrote:
>I am new to perl and do not have any idea about this language.
>I need your help to solve my problem.
>
>I have internet access on my desktop but each time my machine got
>rebooted I need to log-in on
>my ISP web's page by providing username,password and submit the button.
>But I do not know perl, If this code is really small, can anyone post
>it ..
>
>Or if it takes time to write this then please provide me some from
>where I can learn something to write this code.
>
>like -- I use this url " http://my_isp_ip_address/indexmail.php" and
>there are only 3 fields.
>
>1 -- text box for username
>2 -- text box for password
>3 -- "Submit" button
>
I'll give you some tips. First get something like tcpick or ethereal, so
you can watch in realtime what is going on during your login. Do it
from their webpage a few times and see what is actually happening.
Then you can use WWW::Mechanize to simulate it. Their are tons of
examples on the net, and WWW::Mech has alot of examples, look in the
man3 subdir of the module distribution.
A simple example
#!/usr/bin/perl
use warnings;
use strict;
use WWW::Mechanize;
my $username = 'user';
my $password = 'pass';
my $url = 'http://www.xyz.com/Login.aspx';
my $mech = WWW::Mechanize->new(autocheck => 1);
$mech->get( $url );
$mech->form_name("login form name");
$mech->field("username", $username);
$mech->field("password", $password);
$mech->click("login button/submit name");
$mech->content() =~ /sm.th. from Track.aspx/ and print "logged in\n"
__END__
As an alternative to WWW::Mechanize, you can also use a combination of
LWP::UserAgent and HTTP::Request::Common
#!/usr/bin/perl
use warnings;
use strict;
use HTTP::Request::Common qw(GET POST);
use LWP::UserAgent;
my $url ="http://my_isp/login.cgi";
my $ua = new LWP::UserAgent(timeout=> 5);
#now actually post the form
my $request = POST $url, [
username => 'foobar',
password => 'foobaz',
];
my $response = $ua->request($request);
my $content = $response->as_string();
print "$content\n";
__END__
###################################################
But like I said, you need to be able to watch your transaction with
tcpick or ethereal, to see exactly what you need to do. There are
many complications, like it may set a cookie.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: 24 Oct 2006 12:07:43 -0700
From: "Brian Wilkins" <bwilkins@gmail.com>
Subject: Re: Automatic login to a web page
Message-Id: <1161716863.483974.223140@b28g2000cwb.googlegroups.com>
zentara wrote:
> On 23 Oct 2006 23:32:29 -0700, "Jagjeet_Singh" <jagjeet.malhi@gmail.com>
> wrote:
>
> >I am new to perl and do not have any idea about this language.
> >I need your help to solve my problem.
> >
> >I have internet access on my desktop but each time my machine got
> >rebooted I need to log-in on
> >my ISP web's page by providing username,password and submit the button.
>
> >But I do not know perl, If this code is really small, can anyone post
> >it ..
> >
> >Or if it takes time to write this then please provide me some from
> >where I can learn something to write this code.
> >
> >like -- I use this url " http://my_isp_ip_address/indexmail.php" and
> >there are only 3 fields.
> >
> >1 -- text box for username
> >2 -- text box for password
> >3 -- "Submit" button
> >
>
> I'll give you some tips. First get something like tcpick or ethereal, so
> you can watch in realtime what is going on during your login. Do it
> from their webpage a few times and see what is actually happening.
>
> Then you can use WWW::Mechanize to simulate it. Their are tons of
> examples on the net, and WWW::Mech has alot of examples, look in the
> man3 subdir of the module distribution.
>
> A simple example
> #!/usr/bin/perl
> use warnings;
> use strict;
> use WWW::Mechanize;
>
> my $username = 'user';
> my $password = 'pass';
> my $url = 'http://www.xyz.com/Login.aspx';
> my $mech = WWW::Mechanize->new(autocheck => 1);
>
> $mech->get( $url );
> $mech->form_name("login form name");
> $mech->field("username", $username);
> $mech->field("password", $password);
> $mech->click("login button/submit name");
>
> $mech->content() =~ /sm.th. from Track.aspx/ and print "logged in\n"
> __END__
>
>
> As an alternative to WWW::Mechanize, you can also use a combination of
> LWP::UserAgent and HTTP::Request::Common
>
> #!/usr/bin/perl
> use warnings;
> use strict;
> use HTTP::Request::Common qw(GET POST);
> use LWP::UserAgent;
>
> my $url ="http://my_isp/login.cgi";
>
> my $ua = new LWP::UserAgent(timeout=> 5);
>
> #now actually post the form
> my $request = POST $url, [
> username => 'foobar',
> password => 'foobaz',
> ];
>
> my $response = $ua->request($request);
> my $content = $response->as_string();
>
> print "$content\n";
> __END__
>
>
> ###################################################
>
> But like I said, you need to be able to watch your transaction with
> tcpick or ethereal, to see exactly what you need to do. There are
> many complications, like it may set a cookie.
>
>
>
> --
> I'm not really a human, but I play one on earth.
> http://zentara.net/japh.html
Or you can try Curl.
sub do_curl {
my $curl = Curl::easy::init();
if(!$curl) {
die "curl init failed!\n";
}
my $url = "enter your url here";
my $rawHTML = ""; # stores the return HTML
$::errbuf = "";
Curl::easy::setopt($curl, CURLOPT_ERRORBUFFER, "::errbuf");
Curl::easy::setopt($curl, CURLOPT_URL, $url);
Curl::easy::setopt($curl, CURLOPT_NOPROGRESS, 1);
Curl::easy::setopt($curl, CURLOPT_TIMEOUT, 30);
Curl::easy::setopt($curl, CURLOPT_HEADERFUNCTION, \&header_callb);
Curl::easy::setopt($curl, CURLOPT_WRITEFUNCTION, \&body_callb);
Curl::easy::setopt($curl, CURLOPT_POST, 1);
Curl::easy::setopt($curl,
CURLOPT_POSTFIELDS,"username=xyz&password=xyz");
Curl::easy::setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
Curl::easy::setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
Curl::easy::setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0");
Curl::easy::perform($curl);
Curl::easy::cleanup($curl);
}
# Used with cURL; stores the raw HTML retrieved
sub body_callb {
my($chunk,$handle)=@_;
${handle} .= $chunk;
$rawHTML .= $chunk;
return length($chunk);
}
# Used with cURL; gets header for debugging purposes.
sub header_callb {
return length($_[0]);
}
If it sets a cookie, Curl can handle that too, but it gets more
complicated. It's hard for us to give you an accurate script without
having a valid logon and a way to test.
------------------------------
Date: Tue, 24 Oct 2006 14:13:57 -0400
From: Amer Neely <softouch@softouch.on.ca>
Subject: Re: Can't find string terminator ...
Message-Id: <tJs%g.172985$sS1.132348@read1.cgocable.net>
John Bokma wrote:
> Amer Neely <softouch@softouch.on.ca> wrote:
>
>> Hmm. That looks like a *nix command, but I'm running on Windoze 2K. I
>> did solve the immediate problem as posted, but it still doesn't answer
>> why this situation arose in the first place. I guess I'll never know.
>
> I recall that you wrote that there was an additional \x0a in your code.
>
> Furthermore, you can install cat, ls, grep, wget, etc. [1] on a computer
> running Windows 2000 (If you don't like Windows, and need to call it
> Windoze, why are you using it in the first place?)
>
> [1] http://johnbokma.com/mexit/2006/07/01/
>
Yeah it's a love-hate thing. I've run a dual-boot with mandrake for a
while but so many of the other apps I use are Windows-based. And I could
never get wine to run TextPad. But I really should get more experience
with linux.
I do have awk and grep available but never thought of cat.
--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
v: 705.223.3539
Perl | MySQL programming for all data entry forms.
"We make web sites work!"
------------------------------
Date: 24 Oct 2006 13:56:25 -0700
From: "Deepu" <pradeep.bg@gmail.com>
Subject: Help with reverse order number generation
Message-Id: <1161723384.263620.163580@m7g2000cwm.googlegroups.com>
Hi All,
I am trying to take the below pattern as input from a file:
0xFF09 0x0819 0x0809
0x8695 0x4527 0xFFFF
0xFEFF 0x0203 0x1617
And need to print in another file in reverse order:
17 16 03 02 FF FE
FF FF 27 45 95 86
09 08 19 08 09 FF
Can somebody please help me on this giving some ideas.
Thanks for your time.
------------------------------
Date: 24 Oct 2006 14:13:08 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Help with reverse order number generation
Message-Id: <1161724387.979062.316590@h48g2000cwc.googlegroups.com>
Deepu wrote:
> I am trying to take the below pattern as input from a file:
> 0xFF09 0x0819 0x0809
> 0x8695 0x4527 0xFFFF
> 0xFEFF 0x0203 0x1617
>
> And need to print in another file in reverse order:
> 17 16 03 02 FF FE
> FF FF 27 45 95 86
> 09 08 19 08 09 FF
>
> Can somebody please help me on this giving some ideas.
Read each line from the file
Capture each two-digit substring in each line
Push a reference to an array of this line's two-digit sequences into a
larger array
After all lines have been read, loop through your array in reverse
order
For each array reference of the large array, print dereferenced array
out.
The following documentation may help you out:
perldoc -f readline
perldoc perlretut
perldoc perlreftut
perldoc -f push
perldoc perlsyn
perldoc -f reverse
Once you've made an attempt to solve your problem, feel free to post a
short-but-complete script that demonstrates any errors you may
encounter. We can probably help you to fix them.
Paul Lalli
------------------------------
Date: 24 Oct 2006 14:36:32 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: Help with reverse order number generation
Message-Id: <1161725792.178408.194250@i3g2000cwc.googlegroups.com>
Deepu wrote:
> Hi All,
>
> I am trying to take the below pattern as input from a file:
> 0xFF09 0x0819 0x0809
> 0x8695 0x4527 0xFFFF
> 0xFEFF 0x0203 0x1617
>
> And need to print in another file in reverse order:
> 17 16 03 02 FF FE
> FF FF 27 45 95 86
> 09 08 19 08 09 FF
>
> Can somebody please help me on this giving some ideas.
>
> Thanks for your time.
there might be a tighter way to get the output the way you like, but
how about:
C:\tmp>cat tmp.txt
0xFF09 0x0819 0x0809
0x8695 0x4527 0xFFFF
0xFEFF 0x0203 0x1617
C:\tmp>perl -MList::MoreUtils=natatime -l -0777 -ne "
$,=' ';
@_=reverse /([[:xdigit:]]{2})/g;
$_=natatime(6,@_);
print @_ while @_=$_->()" tmp.txt
17 16 03 02 FF FE
FF FF 27 45 95 86
09 08 19 08 09 FF
lol,
-jp
------------------------------
Date: Tue, 24 Oct 2006 23:43:57 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: Help with reverse order number generation
Message-Id: <ehm1nq$9aj$1@mlucom4.urz.uni-halle.de>
Thus spoke Deepu (on 2006-10-24 22:56):
> I am trying to take the below pattern as input from a file:
> 0xFF09 0x0819 0x0809
> 0x8695 0x4527 0xFFFF
> 0xFEFF 0x0203 0x1617
>
> And need to print in another file in reverse order:
> 17 16 03 02 FF FE
> FF FF 27 45 95 86
> 09 08 19 08 09 FF
>
Looks like you have to read all your stuff
via the filehandle FH
push @arr, [ map +(/x(..)(..)/)[0,1], split ] while (<FH>);
and then simply print it "reverse/reverse"
print +(join ' ', reverse @$_), "\n" for (reverse @arr);
But surely this problem can be solved with
clever one-liners too ;-)
Regards
Mirco
------------------------------
Date: Tue, 24 Oct 2006 11:07:02 -0700
From: Jonathan@D4HRQQB1.i-did-not-set--mail-host-address--so-tickle-me
Subject: HTML::TokeParser; __DATA__ as a filehandle
Message-Id: <uac3l8u61.fsf@D4HRQQB1.i-did-not-set--mail-host-address--so-tickle-me>
This is an embarrassingly simple question, but I'm trying to get
HTML::TokeParser to execute an example even simpler than the one given as an
example in the docs.
I expect to get output of "3" from the program Instead, I get "0."
What is the trivial reason for this? Is there a problem with my use
of __DATA__, or my reference to main::DATA? Is the central loop not
working?
I hope that I have done enough of my homework on this to warrant a meaningful
response. If I have to go back to perlopen or perlreftut, please let me know.
Here is my sample program:
#!/usr/bin/perl -w
use warnings;
use strict;
use diagnostics;
use HTML::TokeParser;
my $fh = \<main::DATA>;
my $p = HTML::TokeParser->new($fh) || die "Bad open: $! \n";
my $heading3s = 0;
while (my $token=$p->get_tag("<h3>")){
$heading3s++;
}
print "Number of Level 3 Headings: $heading3s\.\n";
__DATA__
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>Test Page</title>
</head>
<body>
<h3>Alpha</h3>
<h3>Beta</h3>
<h3>Gamma</h3>
</body>
</html>
------------------------------
Date: 24 Oct 2006 11:19:32 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: HTML::TokeParser; __DATA__ as a filehandle
Message-Id: <1161713972.617960.209430@e3g2000cwe.googlegroups.com>
Jonathan@D4HRQQB1.i-did-not-set--mail-host-address--so-tickle-me wrote:
> This is an embarrassingly simple question, but I'm trying to get
> HTML::TokeParser to execute an example even simpler than the one given as an
> example in the docs.
>
> I expect to get output of "3" from the program Instead, I get "0."
> What is the trivial reason for this? Is there a problem with my use
> of __DATA__, or my reference to main::DATA? Is the central loop not
> working?
no, yes, and yes
> I hope that I have done enough of my homework on this to warrant a meaningful
> response. If I have to go back to perlopen or perlreftut, please let me know.
>
> Here is my sample program:
>
> #!/usr/bin/perl -w
>
> use warnings;
> use strict;
> use diagnostics;
>
> use HTML::TokeParser;
> my $fh = \<main::DATA>;
This is attempting to read a line from the DATA filehandle, and then
take a reference to it. Change to:
my $fh = \*main::DATA;
> my $p = HTML::TokeParser->new($fh) || die "Bad open: $! \n";
> my $heading3s = 0;
>
> while (my $token=$p->get_tag("<h3>")){
Read the docs for HTML::TokeParser. get_tag() takes the name of the
tag only - not including the < and > delimiters. Change to:
while (my $token = $p->get_tag('h3')){
> $heading3s++;
> }
>
>
> print "Number of Level 3 Headings: $heading3s\.\n";
Paul Lalli
------------------------------
Date: 24 Oct 2006 11:27:20 -0700
From: "Brian Wilkins" <bwilkins@gmail.com>
Subject: Re: HTML::TokeParser; __DATA__ as a filehandle
Message-Id: <1161714439.973290.33540@f16g2000cwb.googlegroups.com>
Paul Lalli wrote:
> Jonathan@D4HRQQB1.i-did-not-set--mail-host-address--so-tickle-me wrote:
> > This is an embarrassingly simple question, but I'm trying to get
> > HTML::TokeParser to execute an example even simpler than the one given as an
> > example in the docs.
> >
> > I expect to get output of "3" from the program Instead, I get "0."
> > What is the trivial reason for this? Is there a problem with my use
> > of __DATA__, or my reference to main::DATA? Is the central loop not
> > working?
>
> no, yes, and yes
>
> > I hope that I have done enough of my homework on this to warrant a meaningful
> > response. If I have to go back to perlopen or perlreftut, please let me know.
> >
> > Here is my sample program:
> >
> > #!/usr/bin/perl -w
> >
> > use warnings;
> > use strict;
> > use diagnostics;
> >
> > use HTML::TokeParser;
> > my $fh = \<main::DATA>;
>
> This is attempting to read a line from the DATA filehandle, and then
> take a reference to it. Change to:
> my $fh = \*main::DATA;
>
> > my $p = HTML::TokeParser->new($fh) || die "Bad open: $! \n";
> > my $heading3s = 0;
> >
> > while (my $token=$p->get_tag("<h3>")){
>
> Read the docs for HTML::TokeParser. get_tag() takes the name of the
> tag only - not including the < and > delimiters. Change to:
> while (my $token = $p->get_tag('h3')){
>
> > $heading3s++;
> > }
> >
> >
> > print "Number of Level 3 Headings: $heading3s\.\n";
>
> Paul Lalli
Follow what Paul said. I know this is slightly off what you originally
asked for, but if you want to get what's in between the tags, use this
code. Remember to define $result:
my $fh = \*main::DATA;
my $tp = HTML::TokeParser->new(\$fh) or die "Can't open $!";
while (my $tag = $tp->get_tag) {
if($tag->[0] eq 'h3') {
$result .= $tp->get_text("/h3")."\n";
}
}
This code will get what's between <h3> and </h3> (for each set) and
append a newline character to the data. This has worked for me in the
past if you want what's between the tags also.
------------------------------
Date: 24 Oct 2006 12:51:46 -0700
From: "garhone" <cacheung@consumercontact.com>
Subject: Re: LWP and Javascript onclick form
Message-Id: <1161719506.494427.133120@i3g2000cwc.googlegroups.com>
David Dorward wrote:
> garhone wrote:
>
> > <input type="button" value="Submit" onClick="submitCheck()"
>
> > The error I get is "No clickable input with name SUBMIT"
> > My knowledge of javascript is minimal. Can someone direct me to how to
> > use LWP to submit data to this form?
>
> You'd need to dig through the source code of the JS and recreate it in Perl.
>
> You might be better off with one of the modules that mechanise Mozilla or
> Internet Explorer as they can handle JS.
>
>
> --
> David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
> Home is where the ~/.bashrc is
Okay, I went to look at what the submitCheck function is doing. It
looks like it is validating all the data in the input fields, then it
when the data passes all the checks, it "makes available" another
hidden submit button, and it calls a submit function itself.
The javascript looks like
document.getElementById('submit1').innerHTML='<input type="hidden"
name="SUBMIT" value="SUBMIT">';
document.getElementById('thefrom').submit();
I'm not really sure how to recreate this in Perl. Can anyone give me
any ideas?
------------------------------
Date: Tue, 24 Oct 2006 18:22:26 GMT
From: "michelin" <michelin_nospam@tin.it>
Subject: Re: Perl SOAP::Lite NTLM authentication
Message-Id: <CRs%g.15395$Fk1.34577@twister2.libero.it>
"John Bokma" <john@castleamber.com> ha scritto nel messaggio
news:Xns986683B03EDBFcastleamber@130.133.1.4...
> "michelin" <michelin_nospam@tin.it> wrote:
>
>> Hi to all,
>>
>> I'm writing a perl script that has to invoke a Microsoft .net
>> WebService. The WebService is hosted on a Windows Server 2003 host
>> with NTLM Authentication.
>>
>> I'm using SOAP::Lite as soap toolkit, of course.
>>
>> According to SOAP::Lite official documentation (and other examples on
>> the Internet), basic and digest authentication are fully supported,
>> but I can't find any reference to NTLM authentication ... somebody
>> knows if it is possibile to use NTLM authentication with SOAP::Lite?
>> Could you give me some reference, materials and code examples?
>
> Wild guess:
> http://search.cpan.org/search?query=LWP%3A%3AAuthen%3A%3ANtlm+&mode=all
>
Hi John,
how can i use LWP::Authen::Ntlm in conjunction with SOAP::Lite?
BR,
Domenico
> --
> John Experienced Perl programmer: http://castleamber.com/
>
> Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Tue, 24 Oct 2006 21:27:33 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Strange Perl line : Return the result of a function to a function
Message-Id: <9zv%g.71533$E67.4571@clgrps13>
AlexHWGUY wrote:
> I never done a Perl code before but I done some C, PHP, JAVA, etc...
> Peel looked very similar before I failed to understand those lines :
>
> substr($y, 5, 2) = substr($y, 4, 2);
> substr($y, 4, 1) = ".";
>
> How that possible ? It is replacing the 2 char at pos 5 with 2 char at
> pos 4 ?
Yes.
That could also be written as:
substr $y, 4, 3, '.' . substr $y, 4, 2;
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: 24 Oct 2006 12:43:42 -0700
From: news2003@wanadoo.es
Subject: use of variables
Message-Id: <1161719022.135537.205500@e3g2000cwe.googlegroups.com>
#!/usr/bin/perl
# assign variables and values
$a = 10;
$b = 5;
print "\n";
print "trail ". $a + $b . "\n"; # why this???
This produces :
$perl sample3.pl
5
If I change the last statement to
print "trail ". ($a + $b) . "\n"; # why this???
now the result is
$perl sample3.pl
trail 15
Why is that?
Thanks in advance for your help
John
------------------------------
Date: 24 Oct 2006 12:50:44 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: use of variables
Message-Id: <1161719444.448366.321810@f16g2000cwb.googlegroups.com>
news2...@wanadoo.es wrote:
> #!/usr/bin/perl
>
> # assign variables and values
> $a = 10;
> $b = 5;
>
> print "\n";
> print "trail ". $a + $b . "\n"; # why this???
>
> This produces :
>
> $perl sample3.pl
>
> 5
You really shouldn't be asking us for help until you ask Perl for help.
Ask it to tell you when you do something wrong. Add the lines
use strict;
use warnings;
right under your shebang. Then run your program again. Now do you
see what's going wrong?
If you see it, but don't understand why, take a look at the precedence
of operators, found in the operator documentation:
perldoc perlop
Paul Lalli
------------------------------
Date: Tue, 24 Oct 2006 21:27:24 +0100
From: Brian Raven <brian.raven@osbsl.co.uk>
Subject: Re: use of variables
Message-Id: <bqo1a28j.fsf@osbsl.co.uk>
news2003@wanadoo.es writes:
> #!/usr/bin/perl
>
> # assign variables and values
> $a = 10;
> $b = 5;
>
> print "\n";
> print "trail ". $a + $b . "\n"; # why this???
>
> This produces :
>
> $perl sample3.pl
>
> 5
>
> If I change the last statement to
>
> print "trail ". ($a + $b) . "\n"; # why this???
>
> now the result is
>
> $perl sample3.pl
>
> trail 15
>
> Why is that?
If you had included "use warnings;" (and "use strict;" as well of
course), then perl would have given you a hint as to the problem.
Additional hint: check out the precedence and associativity of the
operators that you are using in 'perldoc perlop'.
HTH
--
Brian Raven
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9886
***************************************