[8813] in Perl-Users-Digest
Perl-Users Digest, Issue: 2430 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 27 16:27:33 1998
Date: Mon, 27 Apr 98 12:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 27 Apr 1998 Volume: 8 Number: 2430
Today's topics:
Binary Copy under Perl32 <Steffen.Geschke@erlf.siemens.de>
Re: Binary Copy under Perl32 <rootbeer@teleport.com>
Re: convert an @array into a single $variable? <Tony.Curtis+usenet@vcpc.univie.ac.at>
Cookies <svetter@ameritech.net>
Re: Cookies (brian d foy)
exception handling: typing exceptions?? <sfarrell+usenet@farrell.org>
Re: Grabbing a webpage with Perl <jc@ral1.zko.dec.com>
Re: Grabbing a webpage with Perl (brian d foy)
Help! Internal Server Error???? rpearce@fastlane.net
Re: Help! Internal Server Error???? <sowmaster@juicepigs.com>
Re: Help! Internal Server Error???? <rootbeer@teleport.com>
Re: Help! Internal Server Error???? <admin@hatsoft.com>
Re: libnet installed on activestate nt port <webmaster@fccjmail.fccj.org>
Re: Opening another browser <rootbeer@teleport.com>
Re: PC-based editors for Perl? <David.Boyce@fmr.com>
Re: Perl classes or training (Chris Nandor)
Re: Perl classes or training (Jason Gloudon)
Re: Perl's non-blocking socket support sucks! Please h <jay@rgrs.com>
Re: Porting Perl script to machine w/out perl! <rootbeer@teleport.com>
Re: Problems with Perl performance on AS400 <rootbeer@teleport.com>
Re: QRe: == vs. eq <due@discovernet.net>
Re: Question on sorting jason@cimedia.com
Radio buttons and check boxes <sales@beegroup.co.uk>
Re: Radio buttons and check boxes <rootbeer@teleport.com>
Re: Radio buttons and check boxes (brian d foy)
Re: RMS should be invited to O'Reilly's "Free Software (Chris Nandor)
Re: Runtime Error in Perl <rootbeer@teleport.com>
script advice (JS Dill)
Re: script advice (brian d foy)
split on special chars (++) (dwc)
Re: split on special chars (++) <bmb@ginger.libs.uga.edu>
Re: split on special chars (++) (brian d foy)
Substiting the backslash character <laura.morgan@itron.com>
Re: Substiting the backslash character (brian d foy)
Re: Substiting the backslash character (Mark-Jason Dominus)
Re: Syntax to make my hit counter work? <rootbeer@teleport.com>
Re: Wanted: Your Perl Hacks (brian d foy)
warnings and Getopt::Std <wmooney@voicenet.com>
Why do I get extra line of trash in output? <bobo@cig.mot.com>
Re: Why do I get extra line of trash in output? (brian d foy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 27 Apr 1998 19:06:32 +0200
From: Steffen Geschke <Steffen.Geschke@erlf.siemens.de>
Subject: Binary Copy under Perl32
Message-Id: <3544BB18.9D540EAE@erlf.siemens.de>
Hello,
I am using perl5.004_04 and I have the requirement to copy a binary
file. Currently I am using following code:
--
open (FROM, "from/anywhere") || die "Error: $!\n";
open (TO, ">/somewhere) || die "Error: $!\n";
while(defined($r = read(FROM, $buffer , 4096)) && $r > 0) {
syswrite(TO, $buffer, $r);
}
--
Unfortuntely, perl converst LF and other control symbols like
0A -> 0D 0A
1A -> EOF
So, the contents of the file is corrupted and the file is truncated
at the position where '1A' first occurs.
Does somebody know how I can convience Perl to leave all octets like
it is?! It's binary not ASCII.
Any help is appreciated very much!!! I am almost frustrated.
Thanks for your help and time,
Steffen
------------------------------
Date: Mon, 27 Apr 1998 17:43:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Steffen Geschke <Steffen.Geschke@erlf.siemens.de>
Subject: Re: Binary Copy under Perl32
Message-Id: <Pine.GSO.3.96.980427104244.5877N-100000@user2.teleport.com>
On Mon, 27 Apr 1998, Steffen Geschke wrote:
> Unfortuntely, perl converst LF and other control symbols like
> 0A -> 0D 0A
> 1A -> EOF
Perl doesn't, your system does. Use a module to copy files, or check out
binmode in perlfunc. Or both! :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 27 Apr 1998 19:13:06 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: convert an @array into a single $variable?
Message-Id: <7x3eezrxwd.fsf@beavis.vcpc.univie.ac.at>
Re: convert an @array into a single $variable?, Bryan
<bth@acsu.buffalo.edu> said:
Bryan> Hi, does any one know how to take the seperate
Bryan> elements of an array an pass them all as a string
Bryan> into a single variable?
use join
perldoc -f join
Or maybe you could pass it as a reference,
perldoc perlref
depending on what you actually want to do with it.
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/
"You see? You see? Your stupid minds! Stupid! Stupid!" ~ Eros, Plan9 fOS.
------------------------------
Date: Mon, 27 Apr 1998 12:58:42 -0400
From: Scott Vetter <svetter@ameritech.net>
Subject: Cookies
Message-Id: <3544B942.6FC1@ameritech.net>
In the cookies parameter you can specify an expiration date. In the
doc I have it is hard coded. Is there a way to set this date to the
current date, plus one year? I would perfer seeing the code as opposed
to using a subroutine.
------------------------------
Date: Mon, 27 Apr 1998 13:30:46 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Cookies
Message-Id: <comdog-ya02408000R2704981330460001@news.panix.com>
Keywords: from just another new york perl hacker
In article <3544B942.6FC1@ameritech.net>, svetter@ameritech.net posted:
>In the cookies parameter you can specify an expiration date. In the
>doc I have it is hard coded. Is there a way to set this date to the
>current date, plus one year? I would perfer seeing the code as opposed
>to using a subroutine.
you can see the code and use the subroutine. look at the nifty Date::*
modules on CPAN. read the docs *and* look inside the module :)
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Mon, 27 Apr 1998 16:22:40 GMT
From: stephen farrell <sfarrell+usenet@farrell.org>
Subject: exception handling: typing exceptions??
Message-Id: <87pvi3p73j.fsf@phaedrus.uchicago.edu>
I find that not only do i want to throw exceptions, but i want to
throw different types of exceptions. for instance: module x might want
to throw three different exceptions that it's ok to catch, but one
other than should _not_ be caught, unless i explicitely request doing
so.
I've thought about making a global variable (a kludge, i think) which
gets checked. The biggest problem i have with this is that the
frequent case needs to check that global variable, which is annoying
(it should be the infrequent case).
here's what i mean:
package whatever;
sub do_this {
if ($a) {
die "a";
}
elsif ($b) {
die "b";
}
elsif ($c) {
$whatever::catcheable = 0;
die "c";
}
else {
"ok";
}
}
so now i'd have to do exceptoin handling like such... which is a pain
in the ass:
$x = eval { $w_instance->do_this() };
if ($@ and $whatever::catcheable) {
# whatever
}
else {
# propogate exception
die;
}
(not to mention having to make sure that $whatever::exception gets
reset appropriately)
is there a canonical way of dealing with this which is a little bit
nicer? or, possibly, a way to say REALLY die in an uncatchable way?
Thanks!
------------------------------
Date: Mon, 27 Apr 1998 11:06:21 -0400
From: John Chambers <jc@ral1.zko.dec.com>
Subject: Re: Grabbing a webpage with Perl
Message-Id: <35449EED.252A42F9@ral1.zko.dec.com>
Chris wrote:
> Does anyone know how to have a Perl program get a web page? I just need
> for it to grab a url I give it. Thanks.
If you check with the CPAN archives, the CGI module has a little program
called GET that does this. This does require having a relatively recent perl,
installing the CGI module, and so on, but if you're interested in getting into
all the gory details of writing web tools, it's well worth the effort.
If you just want a fast solution without much depth, there are lots of people
who have written programs that will grab web pages. I did one myself some
time back, as a learning experience, and I keep finding it useful when I deal
with systems that don't have all the latest perl stuff (and where I don't have
super-user privileges so I can't upgrade their libraries for them ;-). You
can find it at http://eddie.mit.edu/~jc/sh/w3cat, which is a little perl4 (;-)
program that acts like cat(1), but also understands URLs that start with
"http://". Sorry, no "ftp://". It's just a little demo program. Also, it doesn't
know how to deal with proxies. I just wrote that one, and it's not in my
web directories yet.
Just yesterday, I did run into one of its limitations. I tried to get some
files from a new web site that supposedly had a lot of musical stuff that
I wanted to look at. What I got was a message telling me that I had to
upgrade my web browser to the latest Netscape, Communicator, or
Internet Explorer. The turkeys wouldn't even talk to my program unless
it did a convincing act of being a web browser (which it isn't, of course).
They wouldn't talk to lynx, either.
You'll probably run across similarly demented web sites, and learning how
to impersonate an acceptable browser ain't easy. But if you're dealing
with cooperative sites, downloading web pages is actually pretty easy.
All you really need to know is that to get http://foo.bar.com/xxx/yyy
you can type:
$ telnet foo.bar.com 80
GET /xxx/yyy
and the data will come pouring out. This is actually sufficient information
to write a program in most languages to fetch a web page. My little
w3cat program is really just this in perl.
(Hmmm ... I wonder if I'll get flamed - or sued - for giving away the secret
of how trivial the web really is? There are people making a lot of money selling
fancy, complex programs that don't do much more than the above. ;-)
------------------------------
Date: Mon, 27 Apr 1998 14:44:14 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Grabbing a webpage with Perl
Message-Id: <comdog-ya02408000R2704981444140001@news.panix.com>
Keywords: from just another new york perl hacker
In article <35449EED.252A42F9@ral1.zko.dec.com>, jc@eddie.mit.edu posted:
>Chris wrote:
>> Does anyone know how to have a Perl program get a web page? I just need
>> for it to grab a url I give it. Thanks.
>
>If you check with the CPAN archives, the CGI module has a little program
>called GET that does this. This does require having a relatively recent perl,
>installing the CGI module, and so on, but if you're interested in getting into
>all the gory details of writing web tools, it's well worth the effort.
the LWP module makes this trivial:
#/usr/bin/perl
use LWP::Simple qw(get);
my $data = get('http://....');
__END__
one might also be interested in the Pelican book [1]
>$ telnet foo.bar.com 80
>GET /xxx/yyy
i'm not a browser, but i play one in telnet :)
[1]
Web Client Programming with Perl
Clinton Wong
ISBN 1-56592-214-X
<URL:http://www.oreilly.com>
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Mon, 27 Apr 1998 11:18:01 -0600
From: rpearce@fastlane.net
Subject: Help! Internal Server Error????
Message-Id: <6i2b3r$rdh$1@nnrp1.dejanews.com>
I'm trying to write what should be a simple perl script to open an html
document and extract email address and then write them to a text file for a
mailing list script. I've tried everything I can think of and I keep getting
that damned Internal Server Error.
Here is the script:
#!/usr/local/bin/perl
#
$guestbookreal = "/homepages/rpearce/alumni_directory.html";
$addressbook = "/homepages/rpearce/address.txt";
print "Content-type: text/plain\n\n";
open(FILE,"$addressbook") || die "Can't Open $addressbook: $!\n";
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;
open (OUT,">>$addressbook") || die "Can't Open $addressbook: $!\n";
for ($i=0;$i<=$SIZE;$i++) {
$_ = $LINES[$i];
if(/mailto:([^\"]+)\"/i) {
$email=$1;
print OUT $email\n;
{
{
close (OUT);
I've edited with notepad and write on win95. My ISP uses cgiwrapper to run
scripts, which I am calling correctly. I can run other scripts that I've
gotten from Matt's or elsewhere. I'm sure it's some simple small thing. Any
ideas? I've tried escaping and not escaping the "s in the if( line. I'm
getting very frustrated.
Rick...
rpearce@fastlane.net
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 27 Apr 1998 13:00:59 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
Subject: Re: Help! Internal Server Error????
Message-Id: <3544B9CB.47AE@juicepigs.com>
rpearce@fastlane.net wrote:
>
> I'm trying to write what should be a simple perl script to open an html
> document and extract email address and then write them to a text file for a
> mailing list script. I've tried everything I can think of and I keep getting
> that damned Internal Server Error.
That "damned Internal Server Error" is telling you that you have a
problem in your code. If you check the "damned Server Error Logs" they
will tell you what the problem is.
>>snipsville<<
> for ($i=0;$i<=$SIZE;$i++) {
> $_ = $LINES[$i];
>
> if(/mailto:([^\"]+)\"/i) {
> $email=$1;
> print OUT $email\n;
> {
> {
4 left brackets and no right brackets?
> I've edited with notepad and write on win95. My ISP uses cgiwrapper to run
> scripts, which I am calling correctly. I can run other scripts that I've
> gotten from Matt's or elsewhere.
Then why not write to Matt and ask him for help?
--
Bob Trieger | Titanic: big boat, bigger
sowmaster@juicepigs.com | iceberg, big deal
------------------------------
Date: Mon, 27 Apr 1998 17:21:04 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: rpearce@fastlane.net
Subject: Re: Help! Internal Server Error????
Message-Id: <Pine.GSO.3.96.980427101953.5877J-100000@user2.teleport.com>
On Mon, 27 Apr 1998 rpearce@fastlane.net wrote:
> I've tried everything I can think of and I keep getting
> that damned Internal Server Error.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 27 Apr 1998 10:53:44 -0700
From: "Henry Wolff" <admin@hatsoft.com>
Subject: Re: Help! Internal Server Error????
Message-Id: <3544c5da.0@news.greatbasin.net>
I don't know if you did this in notepad but:
for ($i=0;$i<=$SIZE;$i++) {
$_ = $LINES[$i];
if(/mailto:([^\"]+)\"/i) {
$email=$1;
print OUT $email\n;
{
{
Shouldn't those last two { be }
Henry Wolff
Send Some Virtual Postcards - FREE
http://www.hatsoft.com/webcard/index.html
rpearce@fastlane.net wrote in message <6i2b3r$rdh$1@nnrp1.dejanews.com>...
>I'm trying to write what should be a simple perl script to open an html
>document and extract email address and then write them to a text file for a
>mailing list script. I've tried everything I can think of and I keep
getting
>that damned Internal Server Error.
>
>Here is the script:
>
>#!/usr/local/bin/perl
>#
>$guestbookreal = "/homepages/rpearce/alumni_directory.html";
>$addressbook = "/homepages/rpearce/address.txt";
>print "Content-type: text/plain\n\n";
>
>open(FILE,"$addressbook") || die "Can't Open $addressbook: $!\n";
>@LINES=<FILE>;
>close(FILE);
>$SIZE=@LINES;
>
>open (OUT,">>$addressbook") || die "Can't Open $addressbook: $!\n";
>
>for ($i=0;$i<=$SIZE;$i++) {
> $_ = $LINES[$i];
>
> if(/mailto:([^\"]+)\"/i) {
> $email=$1;
> print OUT $email\n;
> {
>{
>
>close (OUT);
>
>
>
>I've edited with notepad and write on win95. My ISP uses cgiwrapper to run
>scripts, which I am calling correctly. I can run other scripts that I've
>gotten from Matt's or elsewhere. I'm sure it's some simple small thing.
Any
>ideas? I've tried escaping and not escaping the "s in the if( line. I'm
>getting very frustrated.
>
>Rick...
>rpearce@fastlane.net
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 27 Apr 1998 18:15:33 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: libnet installed on activestate nt port
Message-Id: <3544C998.B1C1A767@fccjmail.fccj.org>
ELSS Admin wrote:
>
> Simple question:
> Can libnet be installed on an activestate nt port?
> Sounds silly, but I'm a little weary.
>
> Is it "newbie-like easy" enough to install?
>
> Thanks
You could prolly shoe-horn it in, with a machette.
HTH, :-)
-Sneex-
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster
------------------------------
Date: Mon, 27 Apr 1998 17:37:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Scott Vetter <svetter@ameritech.net>
Subject: Re: Opening another browser
Message-Id: <Pine.GSO.3.96.980427103452.5877K-100000@user2.teleport.com>
On Mon, 27 Apr 1998, Scott Vetter wrote:
> In HTML I know that I can open another browser session with [<a
> href="http://u.r.l" target="_blank">Some Text</a>, but how can you do it
> within a Perl program?
If you can do this within Perl, it's a simple matter of outputting the
proper data as needed to control the browser. If you're not sure what data
to output, the people in a newsgroup about browsers, CGI scripting, or a
related topic should be able to help you. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 27 Apr 1998 14:34:26 -0400
From: David Boyce <David.Boyce@fmr.com>
Subject: Re: PC-based editors for Perl?
Message-Id: <3544CFB2.BFB568B4@fmr.com>
Jason Gloudon wrote:
> Go to http://www.dejanews.com/home_ps.shtml, and search for
> perl and editor and windows or win32. We've had several recommendations
> for the week.
Also, there is an online listing of perl editors (win32 and other) at
http://reference.perl.com. These recurring suggestions would be better
directed as patches/additions to the editor of that, IMHO. (Ideally the
FAQ would point at it too, so the correct and appropriate answer to this
frequently asked question could be "read the FAQ").
-David
------------------------------
Date: Mon, 27 Apr 1998 12:31:42 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Perl classes or training
Message-Id: <pudge-2704981231550001@ppp-25.ts-1.kin.idt.net>
In article <6i0h7n$20b$1@gaia.ns.utk.edu>, "Bob Gwynne"
<gwynne@utkux.utk.edu> wrote:
# Randal Schwartz wrote in message <8cbttqnhoh.fsf@gadget.cscaper.com>...
# >>>>>> "Bryan" == Bryan Beske <beske@worldnet.att.net> writes:
#
# >Sure, but have they written bestselling Perl books? :-)
# >
# Randal:
# Maybe I'm missing something here, but I don't understand your logic.
# Although you have written a couple of Perl books and obviously know a lot
# about Perl, does that necessarily mean that you are a better teacher of Perl
# than someone who knows Perl, but has not written a book on the subject?
# Perhaps you are but writing a book is not a necessary condition for
# teaching. Perhaps you are a better teacher than everyone else,
# nevertheless, the logic does not hold.
Randal is a professional communicator. He is a very good teacher,
excellent at what he does. He gets a lot of students for his training
business because they think he is good. No, a bestselling book does not
necessarily mean he is a good teacher, but a bestselling tutorial is a
good sign. So yes, he is a good teacher.
Is he necessarily better than x, y or z because of his book? No, of
course not. But he did not say that; he only jokingly hinted at it. Note
the smiley.
http://www.oreilly.com/catalog/smileys
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== New Book: MacPerl: Power and Ease ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
------------------------------
Date: Mon, 27 Apr 1998 18:36:31 GMT
From: jgloudon@hyssop.bbn.com.bbn.com (Jason Gloudon)
Subject: Re: Perl classes or training
Message-Id: <slrn6k9k08.jaq.jgloudon@hyssop.bbn.com>
Andrew M. Langmead <aml@world.std.com> wrote:
.
.
>Last Saturday, I went to a talk given by Randal. When talking about
You did ? Looks like I missed many faces.
--
Jason Gloudon
------------------------------
Date: 27 Apr 1998 14:10:17 -0400
From: Jay Rogers <jay@rgrs.com>
To: dhasting@nyx.net (Damon Hastings)
Subject: Re: Perl's non-blocking socket support sucks! Please help!
Message-Id: <82bttn3zli.fsf@shell2.shore.net>
dhasting@nyx.net (Damon Hastings) writes:
> Okay, maybe it doesn't suck. Maybe I'm just clueless -- I sincerely
> hope so.
Your problem is most likely related to your understanding of how to
use the underlying OS to do non-blocking I/O and not some deficiency
in Perl.
> I'm using the usual Socket.pm stuff to create, bind, and
> connect a socket. I'm setting the O_NONBLOCKING flag with fcntl() to
> make it nonblocking. But there are two things I can't figure out:
>
> 1.) How do I detect when the remote host closes a nonblocking
> connection? (I already tried the return value of read, recv, and
>
> eof.)
When you've read EOF.
> 2.) When I make a nonblocking connect attempt (i.e., I set
> O_NONBLOCKING before calling connect), how do I detect when the
> attempt has completed, and whether it failed or succeeded?
This is highly dependent on which Unix you're using.
> My ultimate goal is to be able to simultaneously open THOUSANDS of
> connections in parallel, with no costly child processes, and with no
> blocking, anywhere, any time, for any reason. Not even once. :-)
It's naive to think that you can have thousands of sockets open at one
time.
> Does anyone know how to do this with Socket.pm or with any other
> module or package, or anything??! A better language maybe???
>
> I have already consulted the man pages. I have read the FAQ. I have
> visited CPAN. I have read the posts to this group. I have
> experimented for hours. I tried Net::TCP and TCP::Client, but they
> seem to just be wrappers for some underlying Socket.pm commands.
Non-blocking I/O works fine with Net::Telnet - just use a timeout of
zero.
$block = $t->get(Timeout => 0);
Use $t->eof to determine when EOF has been read.
You might want to take a look at the Unix socket FAQ for more details:
http://kipper.york.ac.uk/~vic/sock-faq/
--
Jay Rogers
jay@rgrs.com
------------------------------
Date: Mon, 27 Apr 1998 17:04:22 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Yashesh Shroff <yashesh@eecs.berkeley.edu>
Subject: Re: Porting Perl script to machine w/out perl!
Message-Id: <Pine.GSO.3.96.980427100158.5877F-100000@user2.teleport.com>
On Mon, 27 Apr 1998, Yashesh Shroff wrote:
> I have a perl script which I would like to use on another x86 Win95
> machine. However, I won't be allowed to install perl on that machine
> just for this one script!
Are you claiming that you're allowed to install a binary on this machine,
but you can't install a perl binary? That's a rather arbitrary
restriction.
> yashesh<no-spAM!>@eecs.berkeley.edu
Thank you for not mangling your address in your headers. Of course, it's
pointless to mangle it only in the message body. Oh, well!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 27 Apr 1998 17:11:07 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Les Woolsey <lwoolsey@innovative.ca>
Subject: Re: Problems with Perl performance on AS400
Message-Id: <Pine.GSO.3.96.980427101004.5877I-100000@user2.teleport.com>
On Mon, 27 Apr 1998, Les Woolsey wrote:
> I have a simple Perl program which reads a file and extracts some data from
> it. It runs great on a PC under Win NT. But running it on the AS400 is a
> pig. It gets the right answers but exhibits strange performance
> characteristics. It runs for about 20 seconds then locks up and does nothing
> for about 20 second then repeats that cycle until the program finishes.
>
> Anybody have any idea of what's going on or how to fix it?
If it's not buffering, I'd guess that your perl binary is miscompiled. Can
you cut your code down to just a few lines which show this behavior,
though? Then you could post it here and let others try it. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 27 Apr 1998 18:05:32 GMT
From: "Allan M. Due" <due@discovernet.net>
Subject: Re: QRe: == vs. eq
Message-Id: <6i2hdc$o9a$0@206.165.146.177>
Any suggestions for "real newsreaders" for those of us doomed to operate
in a Windoze environment.? Or, are we only real if we have access to UNIX?
Feeling a bit surreal myself at the moment. Never thought I would be judged
by my header.
AmD
P.S. Sorry to post with an politically uncorrect news reader. Feeling a bit
sad I don't have cool toys like the real boys :(
>Then get a real newsreader. :-)
>
>Greg
>--
>open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
>f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
>d2ac158c84c4ece4d22d1000118a8d5491000000
>EOF
------------------------------
Date: Mon, 27 Apr 1998 11:27:59 -0600
From: jason@cimedia.com
Subject: Re: Question on sorting
Message-Id: <6i2bme$srt$1@nnrp1.dejanews.com>
In article <35417155.0@ruby.hknet.com>,
"Bug" <bugking@usa.net> wrote:
>
> ==== a.txt ====
> Aqua::Barbie Girl::1
> Aqua::Doctor Jones::4
> Aqua::Happy Boys And Girls::3
> =============
> I've a text file like above. I want to get the data out and sort them in
> decending order. How to perform this? e-mail to bugking@usa.net
Take a look at the FMTEYEWTK on sorting:
http://www.perl.com/CPAN-local/doc/FMTEYEWTK/sort.html
Jason Bodnar
jason@cimedia.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 27 Apr 1998 18:13:21 +0100
From: Built Environment Engineering Group <sales@beegroup.co.uk>
Subject: Radio buttons and check boxes
Message-Id: <hj08pAAxyLR1EwTj@beegroup.co.uk>
I'm trying to make a perl script gather information from a website
response form. Using and adapting a script from a Demon tutorial page,
I can easily gather info from text fields, but nowhere can I find advice
on how to read radio buttons and check boxes.
Can someone send me a couple of specimen lines in a perl script that
will read a collection of radio buttons and check boxes and relay
whether they are selected.
Thanks in advance. Any help would solve a big headache for a complete
newcomer to this sort of thing.
Please reply if possible to wordsplus@compuserve.com
--
WordsPlus of Chobham (Surrey, UK)
------------------------------
Date: Mon, 27 Apr 1998 17:42:10 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Built Environment Engineering Group <sales@beegroup.co.uk>
Subject: Re: Radio buttons and check boxes
Message-Id: <Pine.GSO.3.96.980427104132.5877M-100000@user2.teleport.com>
On Mon, 27 Apr 1998, Built Environment Engineering Group wrote:
> nowhere can I find advice on how to read radio buttons and check boxes.
Check the docs for a module which can work with those. You can find such a
module on CPAN. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 27 Apr 1998 14:37:34 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Radio buttons and check boxes
Message-Id: <comdog-ya02408000R2704981437340001@news.panix.com>
Keywords: from just another new york perl hacker
In article <hj08pAAxyLR1EwTj@beegroup.co.uk>, Built Environment Engineering Group <sales@beegroup.co.uk> posted:
>I'm trying to make a perl script gather information from a website
>response form. Using and adapting a script from a Demon tutorial page,
>I can easily gather info from text fields, but nowhere can I find advice
>on how to read radio buttons and check boxes.
the CGI.pm module has excellent documentation and lots of examples. it's
referenced in the CGI Meta FAQ.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Mon, 27 Apr 1998 12:39:14 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: RMS should be invited to O'Reilly's "Free Software Summit"
Message-Id: <pudge-2704981239270001@ppp-25.ts-1.kin.idt.net>
In article <m3g1j2apl6.fsf@mute.eaglets.com>, Sam Steingold <sds@usa.net> wrote:
# E.g., *AFAIK*, MS can, *at any time*, request that we stop running win95
# and erase it from our HDs, and whoever doesn't comply is a felon. This
I don't think it would fall under any criminal statutes in any state.
Just a civil offense. No felony involved in the worst case.
IANAL,
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
#== MacPerl: Power and Ease ==#
#== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==#
------------------------------
Date: Mon, 27 Apr 1998 17:01:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Andreas Olsson <seo@sorona.se>
Subject: Re: Runtime Error in Perl
Message-Id: <Pine.GSO.3.96.980427095801.5877E-100000@user2.teleport.com>
On Mon, 27 Apr 1998, Andreas Olsson wrote:
> When parsing small documents the script executes with no problem, but raises
> Runtime Error when parsing bigger documents.
What runtime error is this, and have you seen what perldiag has to say
about it?
> There seems to be a 2^16 limit for matching.
There _are_ limits to the abilities of regular expressions, but that's not
a limit that's generally a problem.
Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 27 Apr 1998 14:16:38 -0400
From: jsd@pobox.com (JS Dill)
Subject: script advice
Message-Id: <jsd-2704981416380001@usr2a43.rut.sover.net>
Good day all..
In my work for an ISP I do a lot of grepping from termlogs to
identify/verify log-ons...a standard grep used is below, this when I don't
have a "user name" available:
grep "Apr 27" /var/log/termlog | egrep "pm0a11.bratt|204.71.18.111" | more
Oviously, there is the date, modem port and the dynamically assigned ip
address.
When a user name is available the grep changes to:
grep "Apr 27" /var/log/termlog | egrep "pm0a11.bratt|204.71.18.111" | grep
-A 2 rjsmusic
What I would like to do is encounter/write a script that would allow
for this access with only a prompt for relevant specifics...say, date,
modem port, ip address, user name (if available).
Would this be possible/reasonable via Perl? Any advice/pointers would
be much appreciated...such sent via email or to the List is fine. Ah, am
using a Mac.
Thanks for any considerations to the above.
--
First Nations/First Peoples Issues
<http://www.dickshovel.com/index.html>
------------------------------
Date: Mon, 27 Apr 1998 14:40:35 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: script advice
Message-Id: <comdog-ya02408000R2704981440350001@news.panix.com>
Keywords: from just another new york perl hacker
In article <jsd-2704981416380001@usr2a43.rut.sover.net>, jsd@pobox.com (JS Dill) posted:
> In my work for an ISP I do a lot of grepping from termlogs to
>identify/verify log-ons
> What I would like to do is encounter/write a script that would allow
>for this access with only a prompt for relevant specifics...say, date,
>modem port, ip address, user name (if available).
> Would this be possible/reasonable via Perl?
this sounds very reasonable. at which point of the project are you having
problems?
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Mon, 27 Apr 1998 17:29:00 GMT
From: dwc@davewc.mv.com (dwc)
Subject: split on special chars (++)
Message-Id: <357dbe44.1049031337@news.ultranet.com>
Having trouble with special characters in my split pattern. I
basically want the user to specify what substring to search for and
then I do a split on the string of that substring. If anything is
returned, I know that substring was found.
$str = "C, C++, Perl";
$substring = "C++";
@sections = split( /$substring/, $str );
$matches_found = $#sections;
This results in an error: Nested *?+ in regexp
$str = "C, C++, Perl";
$substring = "C\\+\\+";
@sections = split( /$substring/, $str );
$matches_found = $#sections;
This works fine, but $substring is being passed in and therefore
doesn't contain the proper formatting (\\).
Is there a way to quote or tell split to use $substring as the search
string and not the search regular expression?
TIA.
-dwc
------------------------------
Date: Mon, 27 Apr 1998 13:53:41 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: split on special chars (++)
Message-Id: <Pine.A41.3.96.980427135153.11866J-100000@ginger.libs.uga.edu>
Note the \Q
#!/usr/local/bin/perl -w
use strict;
my( $str, $substring, @sections, $matches_found );
$str = "C, C++, Perl";
$substring = "C++";
@sections = split( /\Q$substring/, $str );
$matches_found = $#sections;
print "@sections\n"; ### prints C, , Perl
On Mon, 27 Apr 1998, dwc wrote:
> $str = "C, C++, Perl";
> $substring = "C++";
> @sections = split( /$substring/, $str );
> $matches_found = $#sections;
>
> This results in an error: Nested *?+ in regexp
>
> Is there a way to quote or tell split to use $substring as the search
> string and not the search regular expression?
---
Brad Baxter, UGA
------------------------------
Date: Mon, 27 Apr 1998 14:36:15 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: split on special chars (++)
Message-Id: <comdog-ya02408000R2704981436150001@news.panix.com>
Keywords: from just another new york perl hacker
In article <357dbe44.1049031337@news.ultranet.com>, dwc@davewc.mv.com (dwc) posted:
>Having trouble with special characters in my split pattern.
>@sections = split( /$substring/, $str );
if you have an interpolation with regular expression and you don't
want the meta-characters to be meta-characters, you can use the
\Q and \E thingys. \Q says "characters up to \E (or the end if there
is no \E) aren't special".
m/\Q$substring\E/;
you can also use handy functions like quotemeta() and such.
see the Camel, the FAQs, and previous posts on this topic for more
info.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Mon, 27 Apr 1998 11:03:41 -0700
From: Laura Morgan <laura.morgan@itron.com>
Subject: Substiting the backslash character
Message-Id: <3544C87D.776C@itron.com>
I'm working on a project where I'm reading a 3rd party product's
configuration file from UNIX & WIN32 environments. The configuration
file has backslashes for path seperator's. I'm reading lines from this
file, and creating directory structures accordingly. Using the
File::Path mkpath, it seems that I need to pass either a foward slash or
2 backslashes for the command to work in WIN32.
So, my question is:
If I have just read a line that contains backslashes for path seperators
into $dirname, how do I substitute the backslash for a forward slash?
I have tried s/\\///, and miscel. other things, but I guess I don't
understand enough about regular expression pattern matching.
Thanks
------------------------------
Date: Mon, 27 Apr 1998 14:31:08 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Substiting the backslash character
Message-Id: <comdog-ya02408000R2704981431080001@news.panix.com>
Keywords: from just another new york perl hacker
In article <3544C87D.776C@itron.com>, laura.morgan@itron.com posted:
>I have tried s/\\///, and miscel. other things, but I guess I don't
>understand enough about regular expression pattern matching.
when you start using a lot of /s and \s in your patterns, it is a
good plan to use a different delimiter for the s and m (and other such)
operators:
s%\\%/%;
you can also escape the /, and get a bad case of leaning toothpick
syndrome:
s/\\/\//;
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 27 Apr 1998 14:53:42 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Substiting the backslash character
Message-Id: <6i2k7m$hsb$1@monet.op.net>
Keywords: accompanist Donnelly tory wisp
In article <3544C87D.776C@itron.com>,
Laura Morgan <laura.morgan@itron.com> wrote:
>I have tried s/\\///, and miscel. other things, but I guess I don't
>understand enough about regular expression pattern matching.
s/\\///g
will confuse the parser, because it will see the third / and think
that it is the end of the s/// operator, as if you had written this:
s/\\// / g
Which means to take the result of the s/// and divide it by the letter 'g'.
You can avoid this interpretation by escaping the third / character,
which will prevent it from terminating the s/// expression:
s/\\/\//g
but that is impossible to read, so just use
s.\\./.g
instead.
(You need the `g' on the end here; it means to replace all the
backslashes, not just the first one.)
Or you could use the `tr' comand:
tr.\\./.
tr/// is supposed to be more efficient than s/// for something like
this.
Also, please do not use
($||!$|..$>>$>)
to represent the empty list. It is too hard to read that way.
Just use ().
------------------------------
Date: Mon, 27 Apr 1998 17:40:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Iain Gatt <iain.gatt@strath.ac.uk>
Subject: Re: Syntax to make my hit counter work?
Message-Id: <Pine.GSO.3.96.980427103804.5877L-100000@user2.teleport.com>
On Mon, 27 Apr 1998, Iain Gatt wrote:
> Newsgroups: comp.lang.javascript, comp.lang.perl.misc
Javascript? Your question doesn't seem to have anything to do with
Javascript.
> I'd appreaciate any help on how to get the hit counter
> operational.
You need to debug it. :-) (I'm being vague because your question was
vague. You know, ask a vague question, get some kinda answer...) If you
can cut your source code down to a dozen lines which aren't doing what you
want, you can post it here and get some help on it. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 27 Apr 1998 13:11:04 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Wanted: Your Perl Hacks
Message-Id: <comdog-ya02408000R2704981311040001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6htq5m$juk$1@nnrp1.dejanews.com>, gzoller@hotmail.com posted:
>I need to collect as many perl CGI security hacks as possible.
>
>NOTE: I am *not* breaking into web sites with this information!
>
>I am a consultant who's client is (I believe) not taking
>enough security precautions with his perl code. I'm trying
>to demonstrate (in the presence of my client) that someone
>can do unintended things unless he lets me install some
>checking/validation code.
most of the stuff you need to learn is referenced in the CGI Meta
FAQ. if you still need help, you should probably hire an expert.
not that i going to recommend one :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Mon, 27 Apr 1998 18:33:37 GMT
From: Bill Mooney <wmooney@voicenet.com>
Subject: warnings and Getopt::Std
Message-Id: <Pine.SUN.3.96.980427142700.16083A-100000@omni1>
Anyone know a good way to get rid of the warning associated with testing
command line arguments with the getopts funciton?
i.e.
use Getopt::Std;
getopts('v')
if (defined($opt_v)) {
# Do stuff here
}
produces a warning like the following:
Identifier "main::opt_v" used only once: possible typo at ...
Is there a "standard" way to remove these warnings?
Thanks
-Will
------------------------------
Date: Mon, 27 Apr 1998 12:29:19 -0500
From: "Richard M Bobo [C]" <bobo@cig.mot.com>
Subject: Why do I get extra line of trash in output?
Message-Id: <3544C06F.167EB0E7@cig.mot.com>
Whenever I use the same filehandle for output after using it
for input earlier with a close, I get an extra line of trash
(portion of a text line that occurs somewhere in the input
and/or output) in the output. If I don't use close after the
output which is possible with single pass outputs (i.e exit
the program and let close occur "automatically"), I get no
trash. If I use a different filehandle name, I also get no
trash. Therefore, I have a workaround, but I still don't
understand why a filehandle can't be used for outputting
if it has been closed after being used for input without
getting trash. I have included an example of code to show
one of my specific findings. Can anyone help? Thanks in
advance.
Richard Bobo
open ( FH, "e300101" );
@allLines = <FH>;
close <FH>;
until ( pop ( @allLines ) =~ /^TBADS DMXUSUB/ ) {
};
open ( FH, "> newsub1" );
print FH @allLines;
close <FH>; #with this I get trash line at end
#without the close line I get no trash
--------
open ( FH, "e300101" );
@allLines = <FH>;
close <FH>;
until ( pop ( @allLines ) =~ /^TBADS DMXUSUB/ ) {
};
open ( FO, "> newsub1" );
print FO @allLines;
close <FO>; #with this I get no trash
------------------------------
Date: Mon, 27 Apr 1998 14:26:01 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Why do I get extra line of trash in output?
Message-Id: <comdog-ya02408000R2704981426010001@news.panix.com>
Keywords: from just another new york perl hacker
In article <3544C06F.167EB0E7@cig.mot.com>, "Richard M Bobo [C]" <bobo@cig.mot.com> posted:
>Whenever I use the same filehandle for output after using it
>for input earlier with a close, I get an extra line of trash
> close <FH>; #with this I get trash line at end
> #without the close line I get no trash
that should be
close FH;
remember that you are closing the FILEHANDLE, not the result of the
<> operator!
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2430
**************************************