[8155] in Perl-Users-Digest
Perl-Users Digest, Issue: 1773 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 30 18:07:40 1998
Date: Fri, 30 Jan 98 15:00:25 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 30 Jan 1998 Volume: 8 Number: 1773
Today's topics:
Re: C++ <Perry.G.Ramsey@lmco.com>
Re: can variables be generated on the fly <zenin@best.com>
Re: Compiling regexs for efficency (Andrew M. Langmead)
Re: daemonizing -- value of setpgrp()? <jdporter@min.net>
Don't forget the Perl Journal (was Re: Good place to st (Jonathan King)
Re: Don't use signal handlers (was Re: Child processes) <steve.tolkin@fmr.com>
Re: Don't use signal handlers (was Re: Child processes) <markm@nortel.ca>
Re: Don't use signal handlers (was Re: Child processes) (Earl Hood)
Re: Don't use signal handlers (was Re: Child processes) (Ilya Zakharevich)
Re: email address <*@qz.to>
Re: Help with SORT <jim.michael@gecm.com>
Re: Help: Can clients use select? <zenin@best.com>
Re: How do you make the something case-insensitive? (Gabor)
Re: How do you setup named parameters in objects <jsd@hudsucker.gamespot.com>
How to install perl on SySV.4? <slg@mycroft.cmhnet.org>
Re: module variable scope (Andrew M. Langmead)
Re: modulo operator <franzen@pmel.noaa.gov>
Re: perl 5 compiler - Is there one? <ebohlman@netcom.com>
Re: Perl upload function (team lamer)
PerlIS -> NSAPI filters? <hatton@dfdis.com>
Re: PerlIS -> NSAPI filters? <hatton@dfdis.com>
Re: Problem with IO::Select & Socket <gbarr@ti.com>
Proper way to close an IO::Socket or IO::Socket::INET (Mark A. Lehmann)
Re: Really Stupid Question (John Doen)
Re: Seeking Search Engine Code <peterson@cns.uni.edu>
Re: Some possible bugs <zenin@best.com>
testing perl scripts on my local (Eric Smith)
Win32: Any scripts to shut down all services? (Marc Haber)
Re: WWWBoard2.0 A Multiple Boards (Jeff Yoak)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 30 Jan 1998 12:51:09 -0700
From: "Perry G. Ramsey" <Perry.G.Ramsey@lmco.com>
Subject: Re: C++
Message-Id: <34D22F2D.DCE29437@lmco.com>
DAN ALBERTSSON wrote:
>
>
> But is there an IDE for Unix (and/or Windows) out there with color syntax
> highlightning or someting like that.
I use xemacs (http://www.xemacs.org) which has customizable
color highlighting and automatic formatting. It's not an IDE in the
fullest sense, but an open shell window and xemacs works very well.
Even if you hate regular emacs (which I do) xemacs is pretty good.
--
Perry G. Ramsey
Perry.G.Ramsey@lmco.com
------------------------------
Date: 30 Jan 1998 20:43:44 GMT
From: Zenin <zenin@best.com>
Subject: Re: can variables be generated on the fly
Message-Id: <886193320.111167@thrush.omix.com>
Vjekoslav Balas <eedvab@eed.ericsson.se> wrote:
: Can a varibale be generated - this syntax is not correct but shows idea I'm on about:
: $a="var1";
: $"$a"="value of generated variable";
: (supposed to read something like
: $var1="value of generated variable";
$a = "var1";
${$a} = "value of generated variable";
But don't do this if you can avoid it (use hard references, not soft
ones). And read the perlref man page.
--
-Zenin
zenin@best.com
------------------------------
Date: Fri, 30 Jan 1998 21:58:09 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Compiling regexs for efficency
Message-Id: <EnMACz.39y@world.std.com>
Jerome O'Neil <joneil@cks.ssd.k12.wa.us> writes:
>After grepping the perlop and perlre pages, I am a bit confused as to
>the use of regexs in loops, and how they are compiled. The prelre
>document discusses a /o operator that can be used with s///
>(s/PATTERN/REPLACEMENT/) to cause it to only compile once. The prelre
>document refers you to this for "...a description on how to use regular
>expressions with matching and substitution...).
>So, having said that, can you use /o on a normal expression? It doesn't
>cause me any grief in my code, but I was curious if it had any effect?
If the regular expression pattern is a constant, it is compiled once
before the script starts running.
while(<>) {
print if /foo/;
}
If the regular expression contains a variable, the variable has to be
evaluated and then the regular expression recompiled before it is
run. Since it would be tough for perl to check if the variable has or
has not changed since last time, it has to recompile it each time.
@patterns = @ARGV;
while(<STDIN>) {
chomp;
for $pattern (@patterns) {
$hasprinted = 0;
if(/$pattern/) {
print "$_:" unless $hasprinted;
$hasprinted = 1;
print " $pattern";
}
print "\n" if $hasprprinted;
}
}
(This is an very inefficent way of matching multiple regular
expressions. See the FAQ for better ones.)
But if you, the programmer, want to promise perl that the regular
expression won't change, even though it contains a variable, you can
append the /o modifier to the pattern match or substitute operator. It
will then keep the compiled form for each time the operator executes.
my $pattern = shift @ARGV;
while(<>) {
print if /$pattern/o;
}
--
Andrew Langmead
------------------------------
Date: Fri, 30 Jan 1998 16:12:08 -0500
From: John Porter <jdporter@min.net>
Subject: Re: daemonizing -- value of setpgrp()?
Message-Id: <34D24228.76C5@min.net>
David Alan Pisoni wrote:
>
> that using the TIOCNOTTY ioctl on /dev/tty, and closing the STDERR,
> STDOUT, and STDIN pipes would effectively daemonize the process. But when
> I looked back in some of my old code, I was using setpgrp() to achieve
> this state.
setpgrp() seems to be a BSD-oriented function, which means that it is
undependably available on SysV systems, such as Solaris.
The recommended SysV equivalent is setsid(). The Solaris man page for
setpgrp() states that it is obsolescent in favor of setsid().
Both functions release the controlling terminal.
You can close files 0,1,2 yourself if you want, in which case you may
use the setpgid() function set create and join the new process group;
setpgid() does not release the controlling terminal.
I think a simple #ifdef to choose between setpgrp() and setsid() may
be the simplest, and most reliable way.
Others may have a better insight into this issue.
I might also point out that this is not a perl-specific question.
hth,
John Porter
------------------------------
Date: 30 Jan 1998 21:48:19 GMT
From: king@cogsci.ucsd.edu (Jonathan King)
Subject: Don't forget the Perl Journal (was Re: Good place to start in Perl 5)
Message-Id: <6athr3$5bs$1@news1.ucsd.edu>
Here's some details about some of the books that Tom Christiansen
recommended, and a pointer to the Perl Journal, which is getting
better and better.
In article <692ne4$3ok$1@csnews.cs.colorado.edu>
tchrist@mox.perl.com (Tom Christiansen) writes:
>
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc,
> gendress@symbios.com writes:
>:
[request for good Perl 5 books deleted]
>Semi-Beginning Programmers:
> Learning Perl
One mark of a good book is how often (and how long) it goes missing
when you lend it out. I think my Learning Perl book (first edition)
has actually been on my book shelf a total of like two weeks since I
bought it essentially the week it came out. It is a book for
beginning programmers, not experts, but beginners seem to sense
this.
> Cross-platform Perl
The author of this *was* Eric F. Johnson, who is also a noted Tcl
person, Linux enthusiast, and a columnist for, uh, Unix Review?
Anyway, he's now Eric Foster-Johnson, probably not *just* to confuse
people, but there you are. Web page is:
http://www.pconline.com/~erc/homepage.htm
Some people here might be torqued by his advice on when to use Tcl
versus Perl. Or not. I point him out in particular since his books
have tended to come out with publishers that might not be on your
"A" list.
>Serious Programmers:
[snip]
> Programming Perl
> Advanced Perl Programming
These two, especially the first, are really, really, important for
any serious perl programmer. Buy them if you're even tempted.
HOWEVER (and I do mean to shout here), I was really *pissed* at the
number of typos and other flaky things that turned up in my copies
of these books. Yes, they were first printings, but it did make me
a little sad to see O'Reilly books that went to the printers with as
many warts as these had. I mean, we're not talking Sybex or Que
here...
>Other Good Stuff:
> Mastering Regular Expressions
This is a book I failed to buy on one occasion because I thought it
would make me look too geeky. Which is a scary thought.
[snip]
> HTML: The Definitive Reference
Er, don't you really mean:
HTML: The definitive Guide, 2nd Edition (Yet Another ORA product)?
If you don't mean it, I do. But speaking of the non-perlescent,
I suspect many people reading this might be very interested in:
XML: Principles, Tools, and Techniques (World Wide Web Journal:
Volume 2, Issue 4)
...although the perl examples contained therein are less than
stellar. Lots of this stuff is available on the web, but I can't
really take that with me on the bus in the morning.
But speaking of journals, the real deal in the world of Perl is:
The Perl Journal
Which you can pick up at finer bookstores everywhere just in case
you boneheadedly let your subscription lapse. For more info, take a
look at:
http://orwant.www.media.mit.edu/the_perl_journal/
There have been a couple not-so-great articles published there, but
most of it is outstanding.
jking
------------------------------
Date: Fri, 30 Jan 1998 15:02:49 -0500
From: Steven Tolkin <steve.tolkin@fmr.com>
To: chip@pobox.com, steve.tolkin@fmr.com
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <34D231E9.82115741@fmr.com>
For 3% ?!
Chip Salzenberg wrote:
> ...I repeat, with feeling: IT DOES NOT WORK CONSISTENTLY. I know this
> for a fact. I've creatd a patch for reliable signals, but because it
> incurs a 3% performance penalty (though modifying the main Perl
> operation loop) it hasn't been incorporated into official Perl....
I am very curious about this. A 3% performance hit, even if it affects
every Perl programm even those not using signals, is really quite small in
exchange for correct behavior! Who decided this should not be
incorporated? Was this patch ready in time for 5.004? Will it be in the
next official release? I hope so. I've never coded a signal handler in
perl -- but I'd like Perl to become universally accepted and corectness
really helps.
Steve
--
Steven Tolkin steve.tolkin@fmr.com 617-563-0516
Fidelity Investments 82 Devonshire St. R27C Boston MA 02109
There is nothing so practical as a good theory. Remarks are mine.
------------------------------
Date: 30 Jan 1998 15:01:05 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <lq1afcd4tq6.fsf@bmers2e5.nortel.ca>
chip@mail.atlantic.net (Chip Salzenberg) writes:
> According to tchrist@mox.perl.com (Tom Christiansen):
> >In comp.lang.perl.misc, chip@pobox.com writes:
> >:Don't use Perl signal handlers. Ever.
> >
> >Now, kindly explain to the innocent bystanders
> >when, where, and why that position is untenable.
>
> Never. I'm quite serious.
> --
> Chip Salzenberg - a.k.a. - <chip@pobox.com>
> Like Perl? Want to help out? The Perl Institute: www.perl.org
> -> Ask me about Perl training and consulting <-
> "It's the lemon zester of death!!" // MST3K
Signal handlers are actually something that i have gotten hit with before.
Any allocation in the signal handler has potential to really screw things
up. The longer the time you spend in the signal handler the worse your
chances get. It's even possible to get unobvious core dumps when the
signal handler gets called while perl is inside malloc() (i think that was
my problem).
I Seem to remember something about a "safe signals" patch to perl. What
ever happened to it? Is it true that it rejected due to a 3% hit in speed?
If signal handlers can not be implemented safely in perl, should they not
be a deprecated feature? If not they should be fixed. If they were fixed,
i don't believe 3% is that much of a sacrifice.
mark
-- _________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Northern Telecom Ltd. |
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | Box 3511, Station 'C' |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, ON K1Y 4H7 |
markm@nortel.ca / al278@freenet.carleton.ca |_______________________|
------------------------------
Date: 30 Jan 1998 22:05:43 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <6atirn$4e8@news.service.uci.edu>
In article <lq1afcd4tq6.fsf@bmers2e5.nortel.ca>,
Mark Mielke <markm@nortel.ca> wrote:
>If signal handlers can not be implemented safely in perl, should they not
>be a deprecated feature? If not they should be fixed. If they were fixed,
>i don't believe 3% is that much of a sacrifice.
Not an answer to the question, but a follow-up questions:
Is it possible to extract signal handling into a dynamically loaded
module? Therefore the performance hit will only occur if the
programmer chooses to "use Signals".
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 30 Jan 1998 22:26:58 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Don't use signal handlers (was Re: Child processes)
Message-Id: <6atk3i$7ge$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Mark Mielke
<markm@nortel.ca>],
who wrote in article <lq1afcd4tq6.fsf@bmers2e5.nortel.ca>:
> Signal handlers are actually something that i have gotten hit with before.
> Any allocation in the signal handler has potential to really screw things
> up. The longer the time you spend in the signal handler the worse your
> chances get. It's even possible to get unobvious core dumps when the
> signal handler gets called while perl is inside malloc() (i think that was
> my problem).
I also thought so, but apparently some other thing than malloc() is
more frequent.
> I Seem to remember something about a "safe signals" patch to perl. What
> ever happened to it? Is it true that it rejected due to a 3% hit in speed?
Not only this, but also semantic change (the handlers will be delayed,
what is not always possible - consider SIGCHLD and SIGSEGV).
Both the slowdown and semantic change could have been addressed. It
is the round tuits which are scarce.
Ilya
------------------------------
Date: 30 Jan 1998 21:42:26 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: email address
Message-Id: <qz$9801301612@qz.little-neck.ny.us>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
> cberry@cinenet.net (Craig Berry) writes:
> :So, for example, if $email were obtained from the user, I might write:
>
> Bogotic.
>
#!/usr/bin/perl -w
($re = <<'EoRE') =~ tr:\n::d;
(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n
\015()]|\\[^\x80-\xff])*\))*\))*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\
xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"
]|\\[^\x80-\xff])*")(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf
f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[
^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\
xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;
:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))
*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\
n\015()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\
\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\04
0)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-
\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?
:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80
-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\(
(?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]
\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\
\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*|(?:[^(\040)<>@,;:".\\\[\]\000-\0
37\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xf
f\n\015"]|\\[^\x80-\xff])*")(?:[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\03
7]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\
\[^\x80-\xff])*\))*\)|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")*<(?:[\04
0\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]
|\\[^\x80-\xff])*\))*\))*(?:@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x
80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@
,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]
)|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\
\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff
])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^
\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-
\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-
\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\01
5()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*,(?
:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\0
15()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^
\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<
>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xf
f])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^
\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\x
ff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:
[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\00
0-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x8
0-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*)*:(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*)
?(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000
-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")(?:(?:[\040\t]
|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[
^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf
f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\
\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:
[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*@
(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n
\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff
]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\
]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\
xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?
:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80
-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@
,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff
])*\]))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x8
0-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*>)(?:[\040\t]|\((?:[^\\\x80-\xff\n\
015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*
EoRE
sub okay {
my $a = shift;
$a =~ /$re/o
&& print "$a was okay\n";
}
okay( '.@qz.to' ) or print "Foo!\n";
okay( "\b\@qz.to" ) or print "Foo!\n";
okay( '"echo; rm -rf / ;request"@qz.to' ) or print "Foo!\n";
okay( 'eli@(even(this(RE(might(not(be)too)good)for)the)task)qz.to' ) or
print "Foo!\n";
okay( '@known.tld:user@obscure.tld' ) or print "Foo!\n";
__END__
:r! perl -x %
Foo!
Foo!
"echo; rm -rf / ;request"@qz.to was okay
Foo!
@known.tld:user@obscure.tld was okay
The first four of those work, at least with sendmail in a reasonably standard
configuration, but only the last three of them conform to RFC822. Not all mail
programs will deal with all of them, though the first and third should be
widely acepted.
Elijah
------
lest this mysterious RE seem a panacea
------------------------------
Date: Fri, 30 Jan 1998 15:44:26 -0500
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Help with SORT
Message-Id: <34D23BAA.60AA@gecm.com>
Joseph N. Hall wrote:
> Perhaps you'd like to run the code I posted?
Hey, I've been looking for a hierarchical sorting routine. Cool.
Cheers,
Jim
> > Joseph N. Hall (joseph@5sigma.com) wrote:
> > : First, note that as numbers, 1.1 and 1.10 are the same thing.
> >
> > Since the example given had 1.10 following 1.2 in the result, I think a
> > hierarchical ordering is required.
------------------------------
Date: 30 Jan 1998 20:47:00 GMT
From: Zenin <zenin@best.com>
Subject: Re: Help: Can clients use select?
Message-Id: <886193516.401635@thrush.omix.com>
Charlie Nahhas <charles.nahhas@ans.alcatel.co.uk> wrote:
: I have tried this on the client end and I cannot get it to work.
And your code look like...what, exactly?
: Does anyone know if there is a reason why this cannot be done?
Nope, not a one. POST YOUR CODE!
: Is there an alternative to the select function?
Not without pain.
: (I am using recv in nonblocking mode).
So? POST YOUR CODE!
: All responses will be well appreciated.
You're welcome. :-)
--
-Zenin
zenin@best.com
------------------------------
Date: 30 Jan 1998 20:47:10 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: How do you make the something case-insensitive?
Message-Id: <slrn6d4epf.caf.gabor@vnode.vmunix.com>
In comp.lang.perl.misc, Chocolate <poohba@io.com> wrote :
# I have this form and I want to be able to search but I want the case to be
# insensitive. How do I do this?
#
I wonder if it's in the FAQ? Wow, it is. ;-)
------------------------------
Date: 30 Jan 1998 20:18:10 GMT
From: Jon Drukman <jsd@hudsucker.gamespot.com>
Subject: Re: How do you setup named parameters in objects
Message-Id: <6atci2$71m$1@its.hooked.net>
Patrick Hayes <Patrick.Hayes.CAP_SESA@renault.fr> wrote:
: sub new {
: my $class = shift;
: my $self = {};
: bless $self, $class;
:
: return $self;
: }
what you are doing here is ignoring any data that is passed in to the
new call. notice:
my $self = {};
so how is the data supposed to get into $self? magic?
try this:
sub new {
my $class=shift;
bless { @_ }, $class;
}
-jon
------------------------------
Date: Fri, 30 Jan 1998 16:31:05 -0500
From: Sean Gilley <slg@mycroft.cmhnet.org>
Subject: How to install perl on SySV.4?
Message-Id: <34D24699.94FD27FC@mycroft.cmhnet.org>
I've got to install perl on a SysV machine that claims to be
(I think) a MIPS machine. Here's what "uname -a" produces...
name name 4.0 B22IPM32 CM-1475 MIPS/R4400
After logon, the system identifies itself as:
Unix System V Release 4.0 AT&T CM-1475
I can, with some very slight modifications, get a clean compile,
but less than 77% of the tests pass.
I don't have a lists of all the tests failed (I'd be happy to produce
the list if anyone thinks it will help) but as an example, the
first file that fails tests is "bop.t". In that file, tests 4 and
9-12 fail. All have to do with bitwise operation.
We thought that perhaps byte order was screwed up -- in config.sh
the variable "byteorder" was set to "4321". In out test program,
the correct byte order was "1234". But a change to that variable,
along with "make clean;make depend;make; make test" produced
*exactly* the seem test failures.
I'm kindof desperate here. I thought all was well two weeks ago,
and now I realize things are going poorly, and deadlines are getting
close.
*Any* help or pointers to help would be greatly appreciated!
Sean.
sgilley@netexp.net
slg@mycroft.cmhnet.org
------------------------------
Date: Fri, 30 Jan 1998 22:30:59 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: module variable scope
Message-Id: <EnMBvn.29o@world.std.com>
John Porter <jdporter@min.net> writes:
>Certainly a point worth remembering. Now, is there an easy way
>(i.e. not over the head of novice) to access variables in the
>package of the caller? Or should we simply say that this is
>bad practice?
I think it is just bad practice, don't you? The code that uses the
module having some (with no idea of which) of its variables changed
behind its back. It seems the better way of handling it would either
be to have the module export variables for the calling package to
use. (and so the package knows explicitly which variables that it is
sacrificing) Or else the caller might be required to pass the
variables that it wants altered, probably by reference. (So it knows
what is going to be altered and when)
So for Thomas' original example I would think it would be better to
say:
#!/usr/bin/perl -w
# file - Test.pl
use Test_Mod;
set_vars(\$a,\$b));
print "$a $b\n";
# file - Test_Mod.pm
package Test_Mod;
use vars qw(@ISA @EXPORT);
require Exporter;
@ISA = ('Exporter');
@EXPORT=('set_vars');
sub set_vars {
my ($a, $b) = @_;
$$a='A';
$$b='B';
}
1;
or less desirably something like this:
#!/usr/bin/perl -w
# file - Test.pl
use Test_Mod qw($a $b set_vars);
set_vars;
print "$a $b\n";
# file Test_Mod.pm
package Test_Mod;
use vars qw(@ISA @EXPORT @EXPORT_OK);
require Exporter;
use vars qw($a $b);
@ISA = qw(Exporter);
@EXPORT = qw(set_vars);
@EXPORT_OK = qw($a $b);
sub set_vars {
$a = "A";
$b = "B";
}
1;
--
Andrew Langmead
------------------------------
Date: Fri, 30 Jan 1998 12:25:44 -0800
From: Nathan Franzen <franzen@pmel.noaa.gov>
To: chip@pobox.com
Subject: Re: modulo operator
Message-Id: <Pine.SOL.3.96.980130120406.7433B-100000@corona.pmel.noaa.gov>
Regarding the modulo operator,
On Thu, 29 Jan 1998, Chip Salzenberg wrote:
>
> There are two ways of doing %: have the sign of the result be the same
> as the sign of right-hand operand; or have it it negative if the
> left-hand operand is negative xor the right-hand operand is negative.
>
> For 5.004, we had to choose the former because it was compatible with
> 5.003 on the majority of systems we could find. But we made the logic
> consistent so that it would _always_ act like that on _all_ systems.
> --
Thank you for the edification. I had not really thought about negative RH
operands. My prior inclination was to think of "modulo x" as a mapping
into the (positive) space [ 0,|x| ). (That's abs(x) ). I would also
have thought that for x > 0 and y > 0,
-x % y = x % -y
was a true statement. But that's ok. My method is not one of the two you
note above, and I agree that my method is a worse one than the one that
you chose. The 5.004 solution seems consistent and sensible. Thank you
for your work in making it so.
My 5.003 installation, on the other hand, is well and truly broken.
Some results:
corona{franzen}7: perl -e 'print 5 % 3,"\n";'
2
corona{franzen}8: perl -e 'print -5 % 3,"\n";'
1
corona{franzen}9: perl -e 'print 5 % -3,"\n";'
5
corona{franzen}10: perl -e 'print -5 % -3,"\n";'
-8
Oops!
A 5.004 perl (under OpenVMS, even) gives:
franzen> perl -e "print 5 % 3,qq/\n/;"
2
franzen> perl -e "print -5 % 3,qq/\n/;"
1
franzen> perl -e "print 5 % -3,qq/\n/;"
-1
franzen> perl -e "print -5 % -3,qq/\n/;"
-2
Much better!
Regards,
Nathan
------------------------------
Date: Fri, 30 Jan 1998 22:38:55 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: perl 5 compiler - Is there one?
Message-Id: <ebohlmanEnMC8v.A33@netcom.com>
paul Spitalny <pauls@seanet.com> wrote:
: Has anyone come across a perl compiler? I need my code to run faster but don't
: want to have to go to C or C++. Any tips on where I can find a perl compiler
: to run on my windows95 system??
There isn't one. There's a bundler (perl2exe or something like that)
that lets you combine a script and a Perl interpreter into a single .exe
file, but that won't speed things up.
You really need to look into *why* your code is running slowly. Is it a
program that does very little work but needs to be run frequently (e.g. a
typical CGI script)? If so, most of your time overhead is in starting up
an interpreter process and compiling the code. If it is a CGI script,
the best speed-up is to use a server (like Apache with mod-perl) that has
an embedded Perl interpreter so it doesn't have to start up a new process
every time a script is run.
If, OTOH, your program needs to do a lot of work per run, then the first
thing you need to do is profile its various sections, using the Benchmark
module, to find out where the bottleneck is (as a general rule, 80% of a
program's time is spent executing 20% of the code). You then check the
bottleneck code for inefficient constructs (e.g. a sort with a very
involved comparison function; using a Schwartzian transform can speed
that up by a factor of 10 or more) or poor algorithms (e.g. sequentially
searching a list instead of using a hash lookup). If worse comes to
worst, you may need to rewrite key functions in C. The last chapter of
the Camel book has a good section on optimizations for various kinds of
efficiency.
In some cases, of course, it will turn out that your program is I/O
bound, in which case no amount of internal changes to the program will
make it run faster.
------------------------------
Date: Fri, 30 Jan 1998 18:33:47 GMT
From: spam@fritter.com (team lamer)
Subject: Re: Perl upload function
Message-Id: <34d21bcb.2386962@news1.newscene.com>
On Fri, 30 Jan 1998 09:18:36 -0800, Tom Phoenix
<rootbeer@teleport.com> enlightened us with:
>On Thu, 29 Jan 1998, Reimer AG wrote:
>
>> the server gives an error message (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!
It probably wouldn't. Pat was probably using Netscape browser on Unix,
IE on windowz. The input type=file is broke on IE ( seems to be \n\r
placement), I know some people did manage to fix thier cgi's but since
nobody is every going to use IE now, I don't see the point ;)
------------------------------
Date: Fri, 30 Jan 1998 21:11:05 GMT
From: Charlie Hatton <hatton@dfdis.com>
Subject: PerlIS -> NSAPI filters?
Message-Id: <34D242FA.5B61C00A@dfdis.com>
Sorry if this is covered somewhere, but the PerlIS dosc are a little
thin...
Does the PerlIS module allow you to create ISAPI filters, or simply to
run CGIs in the IIS process space (a la ::Registry in NSAPI_Perl or
mod_perl)? I'm interested in rerouting IIS authentication to an Oracle
DB and am hoping to write the necessary ISAPI filter in Perl. Thanks in
advance for any help,
Charlie
------------------------------
Date: Fri, 30 Jan 1998 21:12:50 GMT
From: Charlie Hatton <hatton@dfdis.com>
Subject: Re: PerlIS -> NSAPI filters?
Message-Id: <34D24363.F7A1583B@dfdis.com>
Sorry, meant *I*SAPI filters in the subject, not NSAPI. Sorry for any
confusion...
Charlie
Charlie Hatton wrote:
> Sorry if this is covered somewhere, but the PerlIS dosc are a little
> thin...
>
> Does the PerlIS module allow you to create ISAPI filters, or simply to
> run CGIs in the IIS process space (a la ::Registry in NSAPI_Perl or
> mod_perl)? I'm interested in rerouting IIS authentication to an Oracle
> DB and am hoping to write the necessary ISAPI filter in Perl. Thanks in
> advance for any help,
>
> Charlie
------------------------------
Date: Fri, 30 Jan 1998 13:45:03 -0600
From: Graham Barr <gbarr@ti.com>
Subject: Re: Problem with IO::Select & Socket
Message-Id: <34D22DBF.3C26863C@ti.com>
Aleksi Asikainen wrote:
>
> I wrote a litte script, using IO::Socket, and IO::Select. (And naturally
> it 'requires' 5.002) Win32 build.
>
> It worked well;
Are you sure ?? As far as I am aware IO::Select does not (or has not
been proved to) work on Win32
> my $lis = IO::Socket::INET->new(Proto => 'tcp', LocalPort => 1234,
> Listen => 1, Reurse => 1) || die $!;
Seeing this is really starting to make me think it might be
worth breaking a few scripts so that errors can be caught.
Graham.
--
Originality is the ability to conceal your source.
------------------------------
Date: 30 Jan 1998 16:47:57 -0600
From: mlehmann@prismnet.com (Mark A. Lehmann)
Subject: Proper way to close an IO::Socket or IO::Socket::INET
Message-Id: <5boh0tfujm.fsf@smokey.prismnet.com>
What is the proper way to close a socket created with the IO::Socket or
IO::Socket new() method?
The IO/Socket.pm file method _error does a close($fh) where $fh is set by
"my $fh = shift;" Here the $fh is a Socket object which happens to be Socket
IO:Handle which itself is a dynamically created uniquely-named glob.
To me this looks like it is not a first class object, and therefore does not
have a destrructor which will close a connection when the object goes out of
scope.
IO::Socket::INET is a IO::Socket which is an IO::Handle.
IO::Handle does define a close method which simply does a main::close on the
$fh typeglob.
So I need someone to tell me if the folloing statements are correct:
# Local scope
{
my $sock = IO::Socket::INET->new(PeerAddr => 'www.perl.com',
PeerPort => 80,
PeerProto => 'tcp);
}
# $sock is still a connected socket but there is no way to reference it
# The reference is out of scope but no close was called on the socket handle
# internal to Perl
my $sock = IO::Socket::INET->new(PeerAddr => 'www.perl.com',
PeerPort => 80,
PeerProto => 'tcp);
main::close($sock); # bad way to close $sock because it assumes that
# $sock is a reference to a typeglob that main::close
# recognizes as a socket
$sock->close(); # good way to close $sock becuase it uses IO::Sockets'
# SUPER class (IO::Handle) method "close" which at
# this time just uses the main::close command.
--
Mark Lehmann.
------------------------------
Date: Fri, 30 Jan 1998 20:08:53 GMT
From: tmagnum@coredcs.com-nospam (John Doen)
Subject: Re: Really Stupid Question
Message-Id: <34d23303.529062758@snews2.zippo.com>
On Fri, 30 Jan 1998 19:30:32 GMT, chip@mail.atlantic.net (Chip
Salzenberg) wrote:
>According to tmagnum@coredcs.com-nospam (John Doen):
>>I'm working on a form where the user submits info a perl script
>>processes their choice and outputs the appropriate page. Easy right?
>>Yes it should be. I'm having problems getting the script, contacted
>>below, to get through the If statement. When I run it in debug mode I
>>get a "Use of Uninitialzed Variable" error on the line with the If
>>statement.
>
>Well, then maybe it's using an uninitialized variable?
>
>"Hello? McFly?!"
>
>CGI, CGI, CGI. Will no one rid me of this accursed CGI?
>--
>
I said it was a stupid question, but ummm no kidding. how do I fix
it?
thanks
------------------------------
Date: Fri, 30 Jan 1998 14:19:32 -0600
From: Kerry Peterson <peterson@cns.uni.edu>
Subject: Re: Seeking Search Engine Code
Message-Id: <34D235D4.9009F148@cns.uni.edu>
Matt's script archives http://www.worldwidemart.com/scripts/
Steven Savage wrote:
> I am seeking out free, pre-existing PERL code for a simple CGi search
> engine. Any sources/advice are appreciated - please email
> badger@infinet.com.
>
------------------------------
Date: 30 Jan 1998 20:52:21 GMT
From: Zenin <zenin@best.com>
Subject: Re: Some possible bugs
Message-Id: <886193836.916528@thrush.omix.com>
shaker@netusa1.net wrote:
: I will gladly upgrade. However, it is going to take some time. We have
: perl and several other 'tools' in a central (so-called) software bank. I
: have to persuade the maintainers of this to perform the upgrade for me.
Oh, that's simple. Just make sure they know the fact that Perl4 is
not Y2K compliant and your managers will probably upgrade so fast it
will make your head spin. :-)
--
-Zenin
zenin@best.com
------------------------------
Date: Fri, 30 Jan 1998 16:58:38 -0500
From: eer6517@nospamgarnet.acns.fsu.edu (Eric Smith)
Subject: testing perl scripts on my local
Message-Id: <eer6517-3001981658380001@xyp03-17.acns.fsu.edu>
Is it possible to put perl on a windows 95 or mac os8 machine so I can
test my scripts without having load them to the server everytime I make a
change. Dialing in is a real hassle on a university server, it's always
busy.
If this is possible is there anything important I should know before I do this.
Thanks,
Eric Smith
--
http://garnet.acns.fsu.edu/~eer6517/eric/
------------------------------
Date: Fri, 30 Jan 1998 21:30:57 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Win32: Any scripts to shut down all services?
Message-Id: <6atgqn$659$2@nz12.rz.uni-karlsruhe.de>
Hi!
Did anyone write a script that shuts down all services on a Windows NT
machine? Any hints will be appreciated.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Fri, 30 Jan 1998 21:35:02 GMT
From: jeff@yoak.com (Jeff Yoak)
Subject: Re: WWWBoard2.0 A Multiple Boards
Message-Id: <6atgs6$d67@sjx-ixn2.ix.netcom.com>
Walter Archie <warchie@att.net.hk> wrote:
>Is it possible to run multiple boards under one script? Without having
>to use the DBasic.com script. I do not want to have to pay that over
>crowded fee. So, please help me. Thank you.
Yes, it's possible. It's even fairly easy to do the customization
yourself so one installation will run multiple boards, but if you
don't want to (or can't) do that, and you don't want to pay for added
functionality you might consider installing multiple copies of the
script in different directories (or with different names if you are
restricted as to where your CGI scripts go). That will work fine.
Cheers,
Jeff
Jeff Yoak jeff@yoak.com http://yoak.com/
------------------------------
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 1773
**************************************