[23433] in Perl-Users-Digest
Perl-Users Digest, Issue: 5650 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 13 00:06:33 2003
Date: Sun, 12 Oct 2003 21:05:10 -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 Sun, 12 Oct 2003 Volume: 10 Number: 5650
Today's topics:
[ Curses::UI ] How to make application resize itself t <minceme@start.no>
Re: [ Curses::UI ] How to make application resize itse <tassilo.parseval@rwth-aachen.de>
Re: [ Curses::UI ] How to make application resize itse <minceme@start.no>
Re: [ Curses::UI ] How to make application resize itse <troc@pobox.com>
Re: CGI.pm File Upload doesn't work (blocks) on my Serv <mike@no_address.tld>
CGI.pm File Upload doesn't work (blocks) on my Server ( <bjoern_p1@gmx.net>
chmod files on ISP's server <kalinaubears@iinet.net.au>
Re: chmod files on ISP's server <invalid-email@rochester.rr.com>
Re: Efficient field splitting? unpack or substr (ifiaz)
Re: embedding Variable <mike_solomon@lineone.net>
Re: good time to buy the camel book? <djo@pacifier.com>
Re: good time to buy the camel book? <bobx@linuxmail.org>
Re: Passing form elements using LWP::Useragent <flavell@ph.gla.ac.uk>
Perl Arrays & regex <kfbarry@verizon.net>
Re: Perl Arrays & regex <krahnj@acm.org>
Re: Perl equivalent to a JavaBean (Malcolm Dew-Jones)
Re: Perl equivalent to a JavaBean <kbass@midsouth.rr.com>
Re: Perl equivalent to a JavaBean <djo@pacifier.com>
Re: POP3 & SSL <turajbNOSPAM@hoflink.com>
Re: Post radiobuttons (forms) using lwp-useragent (Rubel Kanubel)
Re: Post radiobuttons (forms) using lwp-useragent <REMOVEsdnCAPS@comcast.net>
Re: Post radiobuttons (forms) using lwp-useragent (Tad McClellan)
Q: good time to buy the camel book? <dpetrou@ece.cmu.edu>
Strange printf behavior <invalid-email@rochester.rr.com>
Re: Using map to assign var values from hash (Malcolm Dew-Jones)
Vector or ArrayList in Perl? <bobx@linuxmail.org>
Re: Vector or ArrayList in Perl? <tassilo.parseval@rwth-aachen.de>
Re: Vector or ArrayList in Perl? <grazz@pobox.com>
Re: Vector or ArrayList in Perl? <REMOVEsdnCAPS@comcast.net>
Re: Vector or ArrayList in Perl? <bobx@linuxmail.org>
Why Is My Hash Assignment Taking So Long? <nospam_for_jkeen@concentric.net>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 12 Oct 2003 18:37:01 +0000 (UTC)
From: Vlad Tepes <minceme@start.no>
Subject: [ Curses::UI ] How to make application resize itself to size of terminal?
Message-Id: <bmc70d$qbf$1@troll.powertech.no>
Hi all!
I'm learning to make text-mode user interfaces with Curses::UI and
I have trouble making my applications resize themselves if the size
of the terminal changes. It would be great if someone could provide
tips on what I need to do.
--
\/L/\D
------------------------------
Date: 12 Oct 2003 20:06:31 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: [ Curses::UI ] How to make application resize itself to size of terminal?
Message-Id: <bmcc87$c96$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Vlad Tepes:
> I'm learning to make text-mode user interfaces with Curses::UI and
> I have trouble making my applications resize themselves if the size
> of the terminal changes. It would be great if someone could provide
> tips on what I need to do.
Back from my days when I used (n)curses from C, I remember having
defined a signal-handler for SIGWINCH (which should be triggered upon
resizing the terminal window). This should work likewise in Perl:
$SIG{ WINCH } = sub {
# do whatever is needed to refresh the screen here
};
I am not acquainted with Curses::UI myself, maybe you need to call
the leave_curses() and then reset_curses() methods in this handler. In
this case your curses object needs to be in the scope of the above
subroutine reference. So maybe you can use a global variable for it (or
at least a closure to restrict its scope as much as possible).
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Sun, 12 Oct 2003 21:50:46 +0000 (UTC)
From: Vlad Tepes <minceme@start.no>
Subject: Re: [ Curses::UI ] How to make application resize itself to size of terminal?
Message-Id: <bmcibm$tt0$1@troll.powertech.no>
* Tassilo v. Parseval (CCLXXXV'th day of year MMIII)
> Also sprach Vlad Tepes:
>
>> I'm learning to make text-mode user interfaces with Curses::UI and
>> I have trouble making my applications resize themselves if the size
>> of the terminal changes. It would be great if someone could provide
>> tips on what I need to do.
>
> Back from my days when I used (n)curses from C, I remember having
> defined a signal-handler for SIGWINCH (which should be triggered upon
> resizing the terminal window). This should work likewise in Perl:
>
> $SIG{ WINCH } = sub {
> # do whatever is needed to refresh the screen here
> };
Thanks for the tip on SIGWINCH and leave/reset_curses. My app gets
this signal, but I still don't know how to make the C::UI widgets
lay out themselves on the screen according to the new terminal size.
According to the docs this could be done by simply calling layout()
on the root window. It doesn't work for me.
--
\/L/\D
------------------------------
Date: Sun, 12 Oct 2003 22:53:56 GMT
From: Rocco Caputo <troc@pobox.com>
Subject: Re: [ Curses::UI ] How to make application resize itself to size of terminal?
Message-Id: <slrnbojmtd.i9.troc@eyrie.homenet>
On Sun, 12 Oct 2003 21:50:46 +0000 (UTC), Vlad Tepes wrote:
>
> Thanks for the tip on SIGWINCH and leave/reset_curses. My app gets
> this signal, but I still don't know how to make the C::UI widgets
> lay out themselves on the screen according to the new terminal size.
> According to the docs this could be done by simply calling layout()
> on the root window. It doesn't work for me.
Have you contacted the author? He's always been very good about
responding to mail about Curses::UI. Perhaps it's a bug nobody has
reported yet.
There's also bug-Curses-UI@rt.cpan.org, if you'd like your e-mail to be
tracked in the CPAN bug tracker.
--
Rocco Caputo - rcaputo@pobox.com - http://poe.perl.org/
------------------------------
Date: Mon, 13 Oct 2003 03:44:29 GMT
From: "mike" <mike@no_address.tld>
Subject: Re: CGI.pm File Upload doesn't work (blocks) on my Server (but works on my Desktop)
Message-Id: <xcpib.754998$uu5.131589@sccrnsc04>
"Bjoern" <bjoern_p1@gmx.net> wrote in message
news:bmcjs3$l8nhd$1@ID-142197.news.uni-berlin.de...
> Hello,
>
> my script handles file uploads (using CGI.pm) fine
How? Posting code would be a good start.
------------------------------
Date: Mon, 13 Oct 2003 00:18:28 +0200
From: Bjoern <bjoern_p1@gmx.net>
Subject: CGI.pm File Upload doesn't work (blocks) on my Server (but works on my Desktop)
Message-Id: <bmcjs3$l8nhd$1@ID-142197.news.uni-berlin.de>
Hello,
my script handles file uploads (using CGI.pm) fine on my Windows Desktop
(with Apache 1.3.28), but it seems to hang on my Linux Server (debian,
Apache 1.3.26). I think it is actually never called, as I don't get any
logging output, either.
What coud be wrong? I've checked that /temp can be written to by anyone,
but other than that, I have no idea. Other scripts in the same directory
and with the same permissions work fine.
Many thanks in advance for any ideas!
Bjoern
P.S.: Because I was drowning in spam, replying to this email will only
trigger an automated reply that will give you my active email address.
Sorry for the inconvenience.
--
Let's not weep for their evil deeds,
but for their lack of imagination
(Nick Cave)
------------------------------
Date: Mon, 13 Oct 2003 12:24:14 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: chmod files on ISP's server
Message-Id: <3f8a0d83$0$23611$5a62ac22@freenews.iinet.net.au>
Hi,
Is there a general way, using perl, to change the permissions of my cgi
scripts once I've uploaded them to my ISP's server ?
I'm using Net::FTP to upload them, but they're arriving without the
necessary 'execute' permissions - and I don't see a way of fixing that
with either Net::FTP or Net::Cmd.
My ISP's help pages tell me that the files need to be set with a 755
permission but they don't tell me how to achieve that. I spoke to a
member of the support staff, but he couldn't tell me anything useful -
maybe I need to speak to a different staff member :-)
Anyway, if there's a perl way that might/should work I'd appreciate the
pointers. And if there's not (in which case my post is OT) ..... well
... I'd still appreciate some pointers on how to proceed :-)
I can see the permissions (via ftp) in the browser - I just haven't yet
found a way to alter them using perl or any other means. (Should it be
achievable via the web browser ?? I would prefer to be doing it with perl.)
Cheers,
Rob
--
To reply by email u have to take out the u in kalinaubears.
------------------------------
Date: Mon, 13 Oct 2003 03:24:30 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: chmod files on ISP's server
Message-Id: <3F8A1AE6.50504@rochester.rr.com>
Sisyphus wrote:
...
> Is there a general way, using perl, to change the permissions of my cgi
> scripts once I've uploaded them to my ISP's server ?
>
> I'm using Net::FTP to upload them, but they're arriving without the
> necessary 'execute' permissions - and I don't see a way of fixing that
> with either Net::FTP or Net::Cmd.
>
> My ISP's help pages tell me that the files need to be set with a 755
> permission but they don't tell me how to achieve that. I spoke to a
> member of the support staff, but he couldn't tell me anything useful -
> maybe I need to speak to a different staff member :-)
>
> Anyway, if there's a perl way that might/should work I'd appreciate the
> pointers. And if there's not (in which case my post is OT) ..... well
> ... I'd still appreciate some pointers on how to proceed :-)
>
> I can see the permissions (via ftp) in the browser - I just haven't yet
> found a way to alter them using perl or any other means. (Should it be
> achievable via the web browser ?? I would prefer to be doing it with perl.)
...
> Rob
Well, if you were at a typical ftp client (like Windoze's ftp, for
example) all logged in and in the correct directory, you could type:
quote site chmod 755 filename.pl
at the ftp> prompt to do that (assuming the remote web server is a
typical Unix-type system). So I suspect the Perlish way would be to use
the ->quot() method in Net::FTP. But I haven't tried it.
Good luck.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: 12 Oct 2003 18:49:18 -0700
From: ifiaz@hotmail.com (ifiaz)
Subject: Re: Efficient field splitting? unpack or substr
Message-Id: <93c1947c.0310121749.30d67490@posting.google.com>
> I have found that unpack is significantly slower as well. I can't say
> conclusively why, but my guess is that it's built to do much more than
> just extract certain characters from a string the way you appear to be
> using it.
>
> Believe it or not, a regex is very fast at this sort of thing if
> performance is a major concern.
>
> my $string = 'one two three four';
> my ($o,$tw,$th,$f) = $line =~ /^(...).(...).(.....).(....)/;
> # or /^(.{3}).(.{3}).(.{5}).(.{4})/
>
> Benchmark this against substr with your data, and I think you'll find
> that this is much faster. In past cases where I've looked to do
> something similar, the regex has won, except in cases where I've
> needed only a small portion of the large string.
Sorry for posting the reply in a compeltely new thread with the subject
name "Re: Efficient field splitting? unpack or substr or regex".
That was in error. So, I hereby repeat the reply below.
I did try to use the regex as you have told me.
But, infact it is slower than substr. It took 23.49 seconds.
Field Splitting in perl using regex, for your info
($F1, $TiltTime, ....) = $_ =~ /(.{2}) (.{8}) (.{2}) ..../;
Thanks to all of you. If you have any further input in this
you are most certainly welcome.
And, for you keith, The delimiters are space, and that can't be changed
atleast for now.
------------------------------
Date: Sun, 12 Oct 2003 20:45:21 +0100
From: "Mike Solomon" <mike_solomon@lineone.net>
Subject: Re: embedding Variable
Message-Id: <3f89aefa$1_1@mk-nntp-2.news.uk.tiscali.com>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnboinps.blo.tadmc@magna.augustmail.com...
> Mike Solomon <mike_solomon@lineone.net> wrote:
>
> > If I write the following code
>
> > my $output "my test = $test\n";
As Tad pointed out should be my $output = "my test = $test\n";
>
> > then I will get
>
>
> A syntax error.
>
>
>
> Do not re-type Perl code
> Use copy/paste or your editor's "import" function rather than
> attempting to type in your code. If you make a typo you will get
> followups about your typos instead of about the question you are
> trying to get answered.
>
>
> Like this one.
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
Point taken Tad
Thanks for the help everyone.
I think I will go the sub routine route unless any one else has any bright
ideas
------------------------------
Date: Mon, 13 Oct 2003 02:39:42 GMT
From: "David Oswald" <djo@pacifier.com>
Subject: Re: good time to buy the camel book?
Message-Id: <Ofoib.13031$YO5.5887559@news3.news.adelphia.net>
"David Petrou" <dpetrou@ece.cmu.edu> wrote in message
news:bmcuuf$cam$1@nntp.ece.cmu.edu...
> hi. i was thinking of buying the 3rd ed. of the camel book. i peruse
> my 2nd ed. copy with increasing regularity and would prefer reading
> the newer edition.
>
> however, the 3rd ed. is copyright 2000 and we're over half done with
> 2003, which seems like a long time for something like perl. how
> likely is it that a 4th ed. will come out in the next 6 months or so?
>
> thanks!
> david, not quite another perl hacker
I still find the 2nd edition quite helpful. When I need the "final word" or
more up-to-date information I just go to the POD's. The book gets me
heading in the right direction and then the POD's fill in the blanks or
bring me up to speed on later developments.
That said, I'll probably end up getting the Camel book anyway, for its more
updated coverage of CPAN modules, core modules, more thorough description of
regexps, etc.
But don't expect to ever own a printed book that is as up to date as Perl's
PODs.
------------------------------
Date: Mon, 13 Oct 2003 02:11:16 GMT
From: "Bob X" <bobx@linuxmail.org>
Subject: Re: good time to buy the camel book?
Message-Id: <8Rnib.423$CE2.478723@news2.news.adelphia.net>
"David Petrou" <dpetrou@ece.cmu.edu> wrote in message
news:bmcuuf$cam$1@nntp.ece.cmu.edu...
> hi. i was thinking of buying the 3rd ed. of the camel book. i peruse
> my 2nd ed. copy with increasing regularity and would prefer reading
> the newer edition.
>
> however, the 3rd ed. is copyright 2000 and we're over half done with
> 2003, which seems like a long time for something like perl. how
> likely is it that a 4th ed. will come out in the next 6 months or so?
>
You could ask the folks at O'Reilly.
------------------------------
Date: Sun, 12 Oct 2003 19:07:00 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Passing form elements using LWP::Useragent
Message-Id: <Pine.LNX.4.53.0310121831310.19596@ppepc56.ph.gla.ac.uk>
On Sun, 12 Oct 2003, Eric J. Roode wrote:
> rubelkanubel@yahoo.no (Rubel Kanubel) wrote in [various groups...?]
>
> > Hi!
>
> If you're going to post the same article to multiple newsgroups,
which, by the way, only really makes sense when the crossposted groups
are widely unrelated, and the article just happens to be genuinely
relevant to both. It's hardly ever appropriate to cross-post to
closely-related groups: pick what seems the most appropriate one, and
go with it. More about this at the end...[1]
> please learn to crosspost properly, rather than posting the article
> to each newsgroup individually.
Hear, hear.
As to the substantive issue raised by the original poster: as far as
server-side scripts are concerned, there's really very little
difference between the different kinds of form "control" (to use the
jargon of the HTML4 specification): be they SELECT groups, radio
button groups, checkboxes or whatever, they deliver one (or more)
parameter name=value pairs from the client to the server, and the
decoding techniques on the server side are identical. The server-side
script cares nothing for just which client-side form element would
have been used, so your LWP call would be effectively the same.
Of course the code as posted could not work, because it doesn't parse.
In any case be sure to use strict, and warnings, just like the (misc)
group's posting guidelines tell you: follow the troubleshooting
advice, and then compose a coherent report (using copy/paste, not
narrative!) if you still need help.
(And if you post that killer phrase "does not work" again, then we'll
know you aren't following the guidelines, and most of the serious folk
who could help you will look the other way...)
good luck
[1] As for posting to a *.misc group _and_ to one of the same
hierarchy's *.[specific] groups, that's practically illogical, since
if it's on-topic for a specific group it effectively rules itself
off-topic for the non-specific group, though there are isolated
exceptions...
However, I have to admit to being a bit ambivalent about the purpose
of the *modules group.
___
/
CHARTER: comp.lang.perl.modules
comp.lang.perl.modules serves as a forum for discussion about:
o how to use existing modules (except Tk)
o module development
END CHARTER.
\___
So it really is both, although they seem in a sense to be strange
bedfellows.
In any case, it doesn't look as if the problem is primarily with the
module as such, but partly with Perl troubleshooting in general (which
I'd opine is on-topic for c.l.p.misc) and partly, I suspect, with
gaining an overview of how things work on the WWW in relation to
client-side and server-side tasks. The latter would be best addressed
by some general reading on those topics, maybe?
Anyway, as you see, I'm suggesting followups to c.l.p.misc for the
Perl-specific part.
------------------------------
Date: Sun, 12 Oct 2003 18:07:50 GMT
From: "Kevin Barry" <kfbarry@verizon.net>
Subject: Perl Arrays & regex
Message-Id: <WLgib.16388$0I6.5410@nwrdny03.gnilink.net>
I'm writing a program to parse words of three or more characters from a file
into an array. But when I load the words into the array and look to print
individual words it seems to have overwritten earlier lines with the last
line in the file. What am I missing here?
#!/usr/bin/perl
#matchtest3.pl
use warnings;
use strict;
my @tempwords;
open FD, "< dslinfo1.txt" or die $!;
while (<FD>){
@tempwords = /\b\w{3,}\b/g;
print @tempwords, "\n";
print $tempwords[2];
}
There's nothing special about the *.txt file just a notepad file with 3
lines of txt.
Kevin
------------------------------
Date: Sun, 12 Oct 2003 19:12:20 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Perl Arrays & regex
Message-Id: <3F89A77D.4C44B4BA@acm.org>
Kevin Barry wrote:
>
> I'm writing a program to parse words of three or more characters from a file
> into an array. But when I load the words into the array and look to print
> individual words it seems to have overwritten earlier lines with the last
> line in the file. What am I missing here?
perldoc -f push
> #!/usr/bin/perl
>
> #matchtest3.pl
>
> use warnings;
> use strict;
>
> my @tempwords;
>
> open FD, "< dslinfo1.txt" or die $!;
>
> while (<FD>){
>
> @tempwords = /\b\w{3,}\b/g;
push @tempwords, /\b\w{3,}\b/g;
> print @tempwords, "\n";
>
> print $tempwords[2];
> }
John
--
use Perl;
program
fulfillment
------------------------------
Date: 12 Oct 2003 11:13:20 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Perl equivalent to a JavaBean
Message-Id: <3f8999c0@news.victoria.tc.ca>
kbass (kbass@midsouth.rr.com) wrote:
: Is there a module within Perl that has the equivalent functionality of a
: JavaBean?
: I would like to use this functionality within CGI without having to go using
: Java. Thanks!
That depends on what you mean by "equivalent functionality". What are
youy trying to accomplish?
------------------------------
Date: Mon, 13 Oct 2003 00:34:20 GMT
From: "kbass" <kbass@midsouth.rr.com>
Subject: Re: Perl equivalent to a JavaBean
Message-Id: <gqmib.5606$oC5.2670@clmboh1-nws5.columbus.rr.com>
"Malcolm Dew-Jones" <yf110@vtn1.victoria.tc.ca> wrote in message
news:3f8999c0@news.victoria.tc.ca...
> kbass (kbass@midsouth.rr.com) wrote:
> : Is there a module within Perl that has the equivalent functionality of a
> : JavaBean?
> : I would like to use this functionality within CGI without having to go
using
> : Java. Thanks!
>
> That depends on what you mean by "equivalent functionality". What are
> youy trying to accomplish?
I am attempting to create a module that would allow me to encapsulate
functionality such as retrieving, updating, inserting and deleting data from
a database table. Before creating this module, I wanted to see if there was
a current module that handled this type of functionality or had some of this
functionality so that I would not have to reinvent the wheel. I could
perform this tasks using a JavaBean with JSP but I was hoping to use Perl
instead.
Kevin
------------------------------
Date: Mon, 13 Oct 2003 02:43:12 GMT
From: "David Oswald" <djo@pacifier.com>
Subject: Re: Perl equivalent to a JavaBean
Message-Id: <4joib.13033$YO5.5888179@news3.news.adelphia.net>
Did you even look at CPAN or the Perl core modules? Good grief. You just
described practically what Perl does best. See the O'Rielly book,
"Programming the Perl DBI."
"kbass" <kbass@midsouth.rr.com> wrote in message
news:gqmib.5606$oC5.2670@clmboh1-nws5.columbus.rr.com...
>
> "Malcolm Dew-Jones" <yf110@vtn1.victoria.tc.ca> wrote in message
> news:3f8999c0@news.victoria.tc.ca...
> > kbass (kbass@midsouth.rr.com) wrote:
> > : Is there a module within Perl that has the equivalent functionality of
a
> > : JavaBean?
> > : I would like to use this functionality within CGI without having to go
> using
> > : Java. Thanks!
> >
> > That depends on what you mean by "equivalent functionality". What are
> > youy trying to accomplish?
>
> I am attempting to create a module that would allow me to encapsulate
> functionality such as retrieving, updating, inserting and deleting data
from
> a database table. Before creating this module, I wanted to see if there
was
> a current module that handled this type of functionality or had some of
this
> functionality so that I would not have to reinvent the wheel. I could
> perform this tasks using a JavaBean with JSP but I was hoping to use Perl
> instead.
>
> Kevin
>
>
------------------------------
Date: Sun, 12 Oct 2003 19:38:30 GMT
From: "James" <turajbNOSPAM@hoflink.com>
Subject: Re: POP3 & SSL
Message-Id: <W4iib.108919$Ri4.33406526@news4.srv.hcvlny.cv.net>
Salva,
I've used "Mail::POP3Client" from CPAN to do this. There is a USESSL
parameter, when set to "1" will enable SSL support, for the POP3 connection.
--
James
turajbNOSPAM@hoflink.com
Salvador Fandino" <sfandino@yahoo.com> wrote in message
news:bmbpvt$lh0$01$1@news.t-online.com...
> Hi,
>
> Does anybody have a perl module or some code to access POP3 mailboxes
> that requiere SSL connections?
>
> Nothing like that seems to be available from CPAN.
>
> Bye,
>
> - Salva
>
------------------------------
Date: 12 Oct 2003 15:04:36 -0700
From: rubelkanubel@yahoo.no (Rubel Kanubel)
Subject: Re: Post radiobuttons (forms) using lwp-useragent
Message-Id: <d9948989.0310121404.4733ce53@posting.google.com>
<tea_spoon>
$req = POST 'http://www.acme.com/login.php', [ rad_query => 'alt_1' ];
$res = $ua->request($req);
</tea_spoon>
Please point out exactly what you mean by "I was about to point out
that you wanted 'alt_1'". FYI, this is just an example of the code
that I'm executing to post form elements. The above two statements
illustrates my attempt (that fails) to post a radio button form
element. I'm sorry for the mis-spellings, but you should be able to
make out for yourself the problem without getting picky about it. The
question is: how can one post radio button form elements by using the
LWP::Useragent module.
Rubel
"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in message news:<Xns941282AC4B3C9sdn.comcast@206.127.4.25>...
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> rubelkanubel@yahoo.no (Rubel Kanubel) wrote in
> news:d9948989.0310120620.7d4f167f@posting.google.com:
>
> > <code>
> >
> > my $req = POST 'http://www.acme.com/login.php', [ rad_query" => 'alt
> > 1' ];
> > my $res = $ua->request($req);
>
> I was about to point out that you wanted 'alt_1' but your code says either
> 'alt 1' or "alt\n1", but then I noticed that the above code can't possibly
> work anyhow.
>
> Please post your real code by copy/paste instead of re-typing it.
>
> - --
> Eric
> $_ = reverse sort $ /. r , qw p ekca lre uJ reh
> ts p , map $ _. $ " , qw e p h tona e and print
>
> -----BEGIN xxx SIGNATURE-----
> Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
>
> iQA/AwUBP4mGYGPeouIeTNHoEQKcGQCg/VAijSzMYZ/6CY/ggRMXudo3BYYAoLNO
> bdLe5OTS6Rjm1fBqgMItn0Bo
> =RKMH
> -----END PGP SIGNATURE-----
------------------------------
Date: Sun, 12 Oct 2003 18:04:27 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Post radiobuttons (forms) using lwp-useragent
Message-Id: <Xns9412C20278CA2sdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
rubelkanubel@yahoo.no (Rubel Kanubel) wrote in
news:d9948989.0310121404.4733ce53@posting.google.com:
> <tea_spoon>
>
> $req = POST 'http://www.acme.com/login.php', [ rad_query => 'alt_1' ];
> $res = $ua->request($req);
>
> </tea_spoon>
>
>
> Please point out exactly what you mean by "I was about to point out
> that you wanted 'alt_1'".
Sure. You said that the possible values of the radio button input were
"alt_1", "alt_2", etc, but the code that you posted had: [ rad_query" =>
'alt
1' ]. Now, the first thing that occurred to me was that your program had
a simple typo in it, and you had a mismatch between the value that the
form required ("alt_1") and the value your program was supplying ("alt
1").
Then I saw that the line had a syntax error in it. That led me to
believe that you had not copy/pasted the code, but instead had retyped
it, and then all bets are off. If you mistyped the ", you could just as
easily have mistyped the CGI value, and God knows what else. How can
anyone help you debug your code if you don't post it, but instead post
something that is *similar* to your code?
> FYI, this is just an example of the code
> that I'm executing to post form elements. The above two statements
> illustrates my attempt (that fails) to post a radio button form
> element.
So even your re-posting above isn't the code that is the problem?
> I'm sorry for the mis-spellings, but you should be able to
> make out for yourself the problem without getting picky about it.
I appreciate your confidence in my abilities, but debugging code that I
can't see is not among my abilities.
> The
> question is: how can one post radio button form elements by using the
> LWP::Useragent module.
It looks like you're doing everything mostly correct. Obviously,
something minor is amiss, and nobody here is going to find it unless you
post a short but working program that illustrates the problem.
- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP4nd8GPeouIeTNHoEQIPPwCgnKT43JJVcAmbbw/qwcPqXYypDuYAoILF
5BlE4I+LgizjSlFcmYCpWl9u
=NVot
-----END PGP SIGNATURE-----
------------------------------
Date: Sun, 12 Oct 2003 20:34:06 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Post radiobuttons (forms) using lwp-useragent
Message-Id: <slrnbok08e.cro.tadmc@magna.augustmail.com>
Rubel Kanubel <rubelkanubel@yahoo.no> wrote:
> Please point out exactly what you mean by "I was about to point out
> that you wanted 'alt_1'".
Your problem specification said so, but your code did not say so.
> I'm sorry for the mis-spellings, but you should be able to
> make out for yourself the problem without getting picky about it.
Computers are picky.
It is likely their pickiness that is the cause of your problem.
If you don't get picky about what instructions you are giving to
the machine, then figuring out why the machine isn't doing what
you want it to do will take a Really Long Time.
There are thousands of people around the world reading what you
write. It is common courtesy to take a bit of care to not lead
them on a wild goose chase in code that does not even exist.
> question is: how can one post radio button form elements by using the
> LWP::Useragent module.
Show us the code if you want us to debug the code.
[ snip Text Over Full-quote Under ]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Oct 2003 01:25:35 GMT
From: David Petrou <dpetrou@ece.cmu.edu>
Subject: Q: good time to buy the camel book?
Message-Id: <bmcuuf$cam$1@nntp.ece.cmu.edu>
hi. i was thinking of buying the 3rd ed. of the camel book. i peruse
my 2nd ed. copy with increasing regularity and would prefer reading
the newer edition.
however, the 3rd ed. is copyright 2000 and we're over half done with
2003, which seems like a long time for something like perl. how
likely is it that a 4th ed. will come out in the next 6 months or so?
thanks!
david, not quite another perl hacker
------------------------------
Date: Mon, 13 Oct 2003 03:12:06 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Strange printf behavior
Message-Id: <3F8A17FE.6010809@rochester.rr.com>
Perl: Activestate build 806 (5.8.0)
OS: Windows 98SE
I note that:
perl -e "printf '%0d %0d',1,2;"
gives: 1 2
but that:
perl -e "printf '%d %d',1,2;"
gives: d
and that:
perl -e "printf '%d %0d',1,2;"
gives: 0d
and that:
perl -e "printf '%d %garbage',1,2;"
gives: garbage
Does anyone else observe this behavior and, if so, have an explanation?
I note that Perl 5.6.1 for Cygwin (B20) does not exhibit this problem.
Thanks.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: 12 Oct 2003 11:17:19 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Using map to assign var values from hash
Message-Id: <3f899aaf@news.victoria.tc.ca>
Eric J. Roode (REMOVEsdnCAPS@comcast.net) wrote:
: Wolfgang Fischer <Wolfgang_.fischer@lycos.de> wrote in
: > you can't use variables like $$_; You have to specify the variable
: > name at compile time, not at run time.
: Please do not post answers to questions unless you know what you're talking
: about.
I think we can safely assume that he thought he knew what he was talking
about, so your advice wouldn't have made any difference.
------------------------------
Date: Sun, 12 Oct 2003 18:52:10 GMT
From: "Bob X" <bobx@linuxmail.org>
Subject: Vector or ArrayList in Perl?
Message-Id: <uphib.317$CE2.406515@news2.news.adelphia.net>
Does Perl have the equivalent of a Vector or ArrayList? I am learning them
in Java currently and was just wondering if there was a Perl equivalent.
------------------------------
Date: 12 Oct 2003 20:08:28 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Vector or ArrayList in Perl?
Message-Id: <bmccbs$cci$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Bob X:
> Does Perl have the equivalent of a Vector or ArrayList? I am learning them
> in Java currently and was just wondering if there was a Perl equivalent.
Perl doesn't need an object of its own for such trivial things. A simple
array is all you need for it. See 'perldoc perlfunc' ("Functions for
real @ARRAYs") to see which functions are available for arrays.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Sun, 12 Oct 2003 20:40:18 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Vector or ArrayList in Perl?
Message-Id: <S_iib.4414$fv4.824@nwrdny02.gnilink.net>
Bob X <bobx@linuxmail.org> wrote:
> Does Perl have the equivalent of a Vector or ArrayList? I
> am learning them in Java currently and was just wondering
> if there was a Perl equivalent.
Not an equivalent (thank god) but plain @arrays are at least
as flexible as Java's array-like collection classes. Have a
look at the "Functions for real @ARRAYs" and "Functions for
list data" in perlfunc, and the standard List::Util module.
If you want array-like collections as Objects, check CPAN
(or have a look at Ruby).
--
Steve
------------------------------
Date: Sun, 12 Oct 2003 18:08:44 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Vector or ArrayList in Perl?
Message-Id: <Xns9412C2BC38F6Fsdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
"Bob X" <bobx@linuxmail.org> wrote in
news:uphib.317$CE2.406515@news2.news.adelphia.net:
> Does Perl have the equivalent of a Vector or ArrayList? I am learning
> them in Java currently and was just wondering if there was a Perl
> equivalent.
>
>
Thank goodness, no. Perl's simple arrays are more capable than Java's
Vectors and ArrayLists. Only languages with poor type flexibility (such as
Java or C++) need such classes.
- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP4ne8GPeouIeTNHoEQLa5gCg4QSQTILQ0M8Pgsnjj0hAjd7S4r8AoJKX
RM50MReSE+OmvhX/pZ4fKD0N
=1Yq+
-----END PGP SIGNATURE-----
------------------------------
Date: Mon, 13 Oct 2003 02:10:25 GMT
From: "Bob X" <bobx@linuxmail.org>
Subject: Re: Vector or ArrayList in Perl?
Message-Id: <lQnib.421$CE2.478702@news2.news.adelphia.net>
Thanks! I actually was reading up on Perl's Array. And your posts confirmed
it!
------------------------------
Date: 13 Oct 2003 03:40:27 GMT
From: "James E Keenan" <nospam_for_jkeen@concentric.net>
Subject: Why Is My Hash Assignment Taking So Long?
Message-Id: <bmd6rb$2c@dispatch.concentric.net>
I need to build a hash whose elements represent characteristics of each of
9600 files in a single directory. I am trying to figure out why this hash
assignment is taking so long. Here is my code:
my %threads_chars = (
dir => "~/Threads",
pattern => "\.thr\.txt",
);
$threadsref = analyze_dir(\%threads_chars);
sub analyze_dir {
my $hashref = shift;
my $dir = ${$hashref}{'dir'};
my $pattern = ${$hashref}{'pattern'};
my (%filechars, $count);
chdir $dir or die "Couldn't change to $dir: $!";
opendir DIR, $dir or die "Couldn't open $dir: $!";
#1: get files in $dir which match pattern
my @files = grep { m|$pattern$|o } readdir DIR;
print '@files established for ', "$dir\n";
#2: build a hash where each element is keyed by the core of the
file name
# and the value is a ref to an array holding the file name, full
path, atime, mtime.
# Set a counter so I know how fast it's going
foreach (@files) {
$_ =~ m|^(.*)$pattern$|;
my $core = $1;
$filechars{$core} = [ $_, "$dir/$_", (stat($_))[8..9] ];
$count++;
if ($count % 100 == 0) { print 'count: ', "$count\n";}
}
closedir DIR or die "Couldn't close $dir: $!";
print "$dir HAS BEEN ANALYZED\n";
return \%filechars;
}
The counter prints to screen in 100-file increments. The first couple of
hundred files zip right by, but then the process slows to a crawl. This
occurred despite there being no other significant activity happening on this
disk. Why?
jimk
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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.
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 5650
***************************************