[8225] in Perl-Users-Digest
Perl-Users Digest, Issue: 1843 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 10 01:07:55 1998
Date: Mon, 9 Feb 98 22:00:23 -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 Mon, 9 Feb 1998 Volume: 8 Number: 1843
Today's topics:
Re: "Mastering Regular Expressions" <rjk@coos.dartmouth.edu>
Re: "Mastering Regular Expressions" (Ilya Zakharevich)
Re: ca anybody explai me this from the perl faq? <rjk@coos.dartmouth.edu>
Can anyone recommend a good perl ODBC book? <nate@wavecomputers.net>
defined() bug? (or feature? :) <morganm@qualcomm.com>
Re: fetching text not from STDOUT (pipe) (Jim Mauney)
From another wingeing newbie <matt.pryor@dial.pipex.com>
Re: Happy with Perl? (Martien Verbruggen)
Hiring skilled programmers! <bblum@earthlink.net>
Re: How to get a listing of the file that is linked? (Martien Verbruggen)
Re: killing a child process after a timeout <tchrist@mox.perl.com>
Re: Linux <tchrist@mox.perl.com>
Re: More regular expressions <rjk@coos.dartmouth.edu>
Re: More regular expressions <rjk@coos.dartmouth.edu>
Re: More regular expressions <rjk@coos.dartmouth.edu>
Re: More regular expressions (Michael Fuhr)
Multithreaded servers and communicating object processe (Jeeves)
Re: Perl documentation (was re: Perl Year 2000 ...) <bcoleman@mindspring.com>
Re: Perl documentation (was re: Perl Year 2000 ...) (Ilya Zakharevich)
Re: Regular expression expander <rjk@coos.dartmouth.edu>
Re: sorting hash by numeric values <rjk@coos.dartmouth.edu>
Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
Re: Syntax-coloring editor for NT <ldanna@hotmail.com>
test!! please ignore this message i am seeing if it wor <bblum@earthlink.net>
Re: The 'study' function (Andrew M. Langmead)
Re: The Specified module can not be found. <bcoleman@mindspring.com>
Re: Year 2000 Compliance: Lawyers, Liars, and Perl (J.M. Davitt)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 09 Feb 1998 22:49:53 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: doswald@xmission.com
Subject: Re: "Mastering Regular Expressions"
Message-Id: <34DFCE64.E1146903@coos.dartmouth.edu>
David Oswald wrote:
>
> 'Advanced [Perl Programming]' sounds very interesting to me, but I
> read another post here mentioning that it is rather error-ridden.
> I'd be surprised if this is true, coming from a publisher like
> O'Reilly, but I would rather not buy it and find out that it is
> indeed troublsome. Would this respected Usenet community recommend
> 'Advanced'?
All first editions have errors. That's one of the reasons there are
second editions. :-)
> The other publication that has my interest is the "Mastering Regular
> expressions" book. Again, I can't find anyone local who has one
> sitting on the shelf. It sounds interesting to me but I'd like to
> hear firsthand that it's a good book. I can always order it, but some
> recommendations first would be greatly appreciated.
>
> [...]
>
> By the way, for those who are considering other Perl titles, I can
> personally strongly recommend Learning Perl and Programming Perl (the
> Llama and Camel books) as well as the somewhat perl oriented Mouse
> book (Programming CGI).
Well, if the errors in the Mouse book didn't bother you, I don't think
you'll have any problems with the Panther or Owls books. ;-)
Seriously, though, I have both Advanced Perl Programming and Mastering
Regular Expressions, and I'm very happy with both of them. MRE was
especially helpful. After reading it, I now feel confident enough to
discuss regexes with Eli on clpm.
Chipmunk
------------------------------
Date: 10 Feb 1998 05:00:35 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: "Mastering Regular Expressions"
Message-Id: <6bomtj$sg2$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Eli the Bearded
<*@qz.to>],
who wrote in article <qz$9802091750@qz.little-neck.ny.us>:
> Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> > Calle Dybedahl <qdtcall@esb.ericsson.se> wrote:
> > > [1] For example, it points out the one case in which $`$&$' isn't
> > > equivalent to the string matched on. I would never in a million
> > I do not remember seeing this bug mentioned before. Is it fixed in
> > newer version? Or is it a feature?
>
> It is a feature. I forget the exact example, but it involved something
> being undefined. For example:
>
> #!/perl -w
> $\ = "\n";
>
> m//;
>
> print q:$_ is defined: if defined($_);
> print q:$` is defined: if defined($`);
> print q:$& is defined: if defined($&);
> print q:$' is defined: if defined($');
>
> __END__
>
> :r! perl -x %
> Use of uninitialized value at /home/qz/.article.28509 line 4.
> $` is defined
> $& is defined
> $' is defined
>
> $`$&$' is the null string (and defined), but $_ is not defined.
There is no such thing as $`$&$'. If you consider "$`$&$'", then it
is no more defined than "$_".
Ilya
------------------------------
Date: Mon, 09 Feb 1998 23:04:50 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: ca anybody explai me this from the perl faq?
Message-Id: <34DFD1E6.AEB4997B@coos.dartmouth.edu>
Gabor wrote:
>
> In comp.lang.perl.misc, Jahnel Klaus <jahnel@xarch.tu-graz.ac.at> wrote :
> # I want to test an array
> # if there is a certain element in an aray but i realy dont understand
> # this procedere which s in the perlfaq.
^^^^^^^^^^^^^^^^^^^^^^
> #
> # # @blues = qw/azure cerulean teal turquoise lapis-lazuli/;
> # # undef %is_blue;
> # # for (@blues) { $is_blue{$_} = 1 }
>
> why the loop, if you only need existance
> @is_blue{@blues} = @blues;
Because the perlfaq hasn't been updated since hash slices were added to
Perl, perhaps?
Chipmunk
------------------------------
Date: Mon, 09 Feb 1998 22:10:57 -0600
From: Nathan Stitt <nate@wavecomputers.net>
Subject: Can anyone recommend a good perl ODBC book?
Message-Id: <34DFD351.23638F27@wavecomputers.net>
I'm looking for either a good perl ODBC book or some links on the web.
I really need something that would describe how to do efficient (read
FAST) ODBC queries with the ActiveState distribution of perl version 5
and the Dave Roth ODBC module.
Thanks in advance,
Nathan Stitt
nate@wavecomputers.net
------------------------------
Date: Mon, 9 Feb 1998 20:14:51 -0800
From: Mark Morgan <morganm@qualcomm.com>
Subject: defined() bug? (or feature? :)
Message-Id: <Pine.GSO.3.95.980209201422.1349N-100000@dragon.qualcomm.com>
I have a module named CONFIG.pm, who's job is to read in a configfile and
load the entries of that file into global variables. So the line:
FOO = somevalue
would result in $FOO evaluating to "somevalue". Simple enough to do,
until I actually made it a module (it was previously just a function in
the main program). The original method of setting up the variable
constituded of:
${ $key } = $value;
Cool deal. But now that it's in it's own module, I still want to set the
global variable, so I have to reference the main symbol table like so:
$::{ $key } = $value;
Unfortunately, that doesn't work, because it expects a reference, not a
value, so I'm have to do the following:
$::{ $key } = \eval{ $value };
The eval being required because I don't want to make it a reference to the
real variable $value, which changes as I read in each line of the config
file. Ok, so everything's pretty cool so far, but here's where things
broke. I require certain variables to be set, so I setup an array with
those variables, and then loop and verify that each one actually exists
before I allow the program to execute, like so:
foreach $var (<@required_vars>)
{
if( !defined( ${ $var } ) ) {
exit "Error, $var not defined.\n";
}
}
Which worked great when the assignment was still local to the main
package, but now that I've switched to assigning it through the symtable
from within the CONFIG module, it seems as if whatever flag gets tickled
to make defined() return true isn't getting set.. So, in the above
example, using my CONFIG module, it would error and say that "FOO" is not
defined. If I do this however:
print "$FOO\n" if $debug;
right before my foreach loop, it'll pass the defined() check (even though
I didn't assign anything, I just referenced the variable by name). So if
I manually touch every variable by it's global name, it will work. But of
course, that defeats the purpose of having a config file with arbitrary
key/value pairs.. :P
Any suggestions as to what I may be doing wrong, or what I can do to get
around this? (is it a bug? or a feature? :) Any help would be
appreciated..
Thanks,
- Mark
------------------------------
Date: Tue, 10 Feb 1998 04:05:21 GMT
From: jmauney@geocities.com (Jim Mauney)
Subject: Re: fetching text not from STDOUT (pipe)
Message-Id: <34dfcffd.2602972@news.netmcr.com>
On Mon, 09 Feb 1998 12:04:07 -0500, Matt Reprogle
<mcreprog@ictest.delcoelect.com> wrote:
>Vegard Hanssen wrote:
>>
>> open(PROG, "program |") || die;
>>
>> while(<PROG>) {
>> <do something with the text>
>> }
>> close PROG;
>>
>> -------
>>
>> I want to fetch the text from the program, but how do I do it when the
>> program not output the text to STDOUT?
>>
>> Vegard
If program outputs to STDERR instead of STDOUT, then you can use a
program called tee.com in WIN32 or probably just tee in Un*x to
capture it (i.e. `tee.com javac mysource.java > "error.msg"`;)
In NT4, you can set STDERR to a file like this:
`javac mysource.java 2> error.msg`. Disclaimer: Haven't been able
to get this to work in a CGI script yet but it works in a straight
Perl5 program.
Jim
------------------------------
Date: Tue, 10 Feb 1998 04:55:31 +0000
From: Matthew Pryor <matt.pryor@dial.pipex.com>
Subject: From another wingeing newbie
Message-Id: <34DFDDC2.899A8760@dial.pipex.com>
I'm brand new to Perl. Found some excellent resources on the www and in
the
documents accompanying the binary, however I'm still a little stumped on
one
issue and wonder if anyone can point me in the right direction to find
the answer.
I'd like to be able to test my perl programs on my local system (W95 OS)
before
handing them over to my server administrator for parsing. This is fine
as long as
I run them from the command line but when I call the scripts from
within
my web browser, it just spawns a new command line. As I guess you'd
expect.
So instead of the output being sent to the browser and then parsed by
the browser,
the html source is merely echoed on the Perl command line, which makes
perfect
sense.
I'd like to know if there's any way for the output to be sent to the
browser instead of spawning a new command line. Any info or pointers
would be much appreciated. I'm
sure this is such a simple issue, but I'm becoming quite frustrated
trying to find the
answer.
If you could reply to me by email, that would be even better.
Thanks!
Matt
------------------------------
Date: 10 Feb 1998 01:54:30 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Happy with Perl?
Message-Id: <6boc0m$i43$1@comdyn.comdyn.com.au>
In article <6bnbrg$iec$1@blinx.lizard.org>,
markl@blinx.lizard.org (Mark Lewis) writes:
> I am looking into the possibility of rewriting all the site-specific shell
> scripts for our company in perl, but am checking to see if anybody else
> has done this and wished they hadn't.
It's possible. I have done many rewrites, never regretted any.
> is perl stable? would it be a good idea to risk millions of pounds on
> something that is unsupported? what do you think?
Unsupported???? You're sending a message to this group, and call perl
unsupported? With this attitude, you might be right, because it might
get you in some people's killfiles.
> can somebody send me a list of other perl newsgroups to send this message to.
Now, that would be a sure way of ending up in those killfiles.
Besides, you can look up perl groups yourself. That information is
freely available. I'll leave the exercise to you.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd. | clothes.
NSW, Australia |
------------------------------
Date: Mon, 09 Feb 1998 20:23:26 +0000
From: Brandon Blum <bblum@earthlink.net>
Subject: Hiring skilled programmers!
Message-Id: <34DF65BD.22987780@earthlink.net>
Hi everyone, my company, web business builder is hiring some
programmers! We are looking for a perl programmer, java programmer,
html designer, activeX programmer and a shockawave programmer. If you
are interested please contact sharewhere@rocketmail.com or post a reply
here!
Thanks,
Brandon
------------------------------
Date: 10 Feb 1998 03:13:44 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: How to get a listing of the file that is linked?
Message-Id: <6bogl8$ig9$1@comdyn.comdyn.com.au>
In article <6boe1e$b8u$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> writes:
> stat() goes through the link, lstat() doesn't. So just stat() it.
> It doesn't matter that it's a link.
Hmm, yeah.. I should of course just have tested..
> touch file
> ln -s file symlink
> perl -e 'print join(":", lstat("symlink")), "\n"'
0:56:41471:1:146:10:268613964:4:887080085:887080085:887080085:8192:16
> perl -e 'print join(":", stat("symlink")), "\n"'
0:51:33204:2:146:10:809040752:0:887080075:887080075:887080075:8192:0
> perl -e 'print join(":", stat("file")), "\n"'
0:51:33204:2:146:10:809040752:0:887080075:887080075:887080075:8192:0
Learn something new every day :)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: 10 Feb 1998 05:38:11 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: killing a child process after a timeout
Message-Id: <6bop43$s4m$1@csnews.cs.colorado.edu>
In comp.lang.perl.misc, chip@pobox.com writes:
:A third approach is to drop the whole mess and write a Perl extension
:(.xs) that handles signals with signal handlers written in C that just
:set a variable which your application can poll.
This is not feasible in the world of autorestarting slow system
calls, which are considered a feature. I hate ^Z, fg causing
"interrupted system call" botches in idiot apps.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
#define SVs_RMG 0x00008000 /* has random magical methods */
--Larry Wall, from sv.h in the v5.0 perl distribution
------------------------------
Date: 10 Feb 1998 04:27:21 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Linux
Message-Id: <6bokv9$ll2$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, efflandt@xnet.com (David Efflandt) writes:
:Linux is a free operating system for PC's that can do most anything
:you can do in UNIX.
Um, Linux *is* Unix. "walks like a duck".
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"I find this a nice feature but it is not according to the documentation.
Or is it a BUG?"
"Let's call it an accidental feature. :-)" Larry Wall in <6909@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Mon, 09 Feb 1998 22:39:11 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: More regular expressions
Message-Id: <34DFCBE2.101B8B9E@coos.dartmouth.edu>
Michael Fuhr wrote:
>
> ThomaJA@LFC.EDU (Mike Binkley) writes:
>
> > Is there a way that I can search for the string (=), but do nothing if it
> > is part of the larger string (:=)?
>
> Take a look at the perlre manual page and read the section about
> negative lookahead assertions. Pay particular attention to what it
> says about lookbehind assertions, since that's what you're
> doing (looking for an "=" that isn't preceded by ":").
So? That does not mean it can't be done. It just means it can't currently
be done with a zero-length assertion.
s/(^|:?)=/$1 = /;
Chipmunk
------------------------------
Date: Mon, 09 Feb 1998 22:43:00 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: More regular expressions
Message-Id: <34DFCCC7.3899764F@coos.dartmouth.edu>
Mikael Skogstrom wrote:
>
> In article <ThomaJA-0802981856330001@magmysmac.lfc.edu>,
> ThomaJA@LFC.EDU (Mike Binkley) wrote:
>
> >Is there a way that I can search for the string (=), but do nothing if it
> >is part of the larger string (:=)?
>
> This should do it:
>
> s/(^:)=/$1 = /
^ ^
> Explaination: If the character preceding the = sign _is not_ a colon, then
> do the substitution by first putting the preceding character in the memory,
> then recall it on the substitution side, also adding a space on each side
> of the = sign.
Yes, except your regex doesn't do that. It matches a colon *at the beginning
of the string*.
You must have meant
s/[^:]=/$1 = /;
which uses a negated character class.
Chipmunk
------------------------------
Date: Mon, 09 Feb 1998 22:41:10 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: More regular expressions
Message-Id: <34DFCC59.40FD4BD9@coos.dartmouth.edu>
Michael Fuhr wrote:
>
> ThomaJA@LFC.EDU (Mike Binkley) writes:
>
> > Is there a way that I can search for the string (=), but do nothing if it
> > is part of the larger string (:=)?
>
> Take a look at the perlre manual page and read the section about
> negative lookahead assertions. Pay particular attention to what it
> says about lookbehind assertions, since that's what you're
> doing (looking for an "=" that isn't preceded by ":").
So? That doesn't mean it can't be done. It just means it can't currently
be done with a zero-length assertion.
s/(^|[^:])=/$1 = /;
Chipmunk
------------------------------
Date: 9 Feb 1998 21:37:34 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: More regular expressions
Message-Id: <6bolie$gg9@flatland.dimensional.com>
Chipmunk <rjk@coos.dartmouth.edu> writes:
> Michael Fuhr wrote:
> >
> > ThomaJA@LFC.EDU (Mike Binkley) writes:
> >
> > > Is there a way that I can search for the string (=), but do nothing if it
> > > is part of the larger string (:=)?
> >
> > Take a look at the perlre manual page and read the section about
> > negative lookahead assertions. Pay particular attention to what it
> > says about lookbehind assertions, since that's what you're
> > doing (looking for an "=" that isn't preceded by ":").
> So? That doesn't mean it can't be done. It just means it can't currently
> be done with a zero-length assertion.
Ummm...where did I say that it can't be done? If you had read the
section I mentioned, you'd see that it mentions how it *can* be done.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: 10 Feb 1998 05:30:50 GMT
From: darlenem@flash.net (Jeeves)
Subject: Multithreaded servers and communicating object processes (proper)
Message-Id: <slrn6dvqpl.507.darlenem@jeeves.flash.net>
This is largely a repost, but after reading the recent discussion of the
uselessness of munged headers, I've changed my ways (now, I can stay out of the
killfiles =)...
I'm working on a medium-sized project that involves a multithreaded TCP server
whose client processes need to be able to communicate with each other. I'm
fairly new to UNIX and I know virtually nothing about IPC. The Camel Book
includes an example of a multithreaded TCP server (p 350) that I have used as a
starting point. What I need is each instance of a certain class to have its own
STDOUT and STDIN, which are redirected to sockets. I have no idea how to go
about doing this, but after many readings of Chapter 6, I wrote this in
the class's source file (irrelevant code omitted):
package Person;
my %fields = (
HANDLE => undef,
);
# expects to receive a filehandle reference (returned from an accept()
# call in the server code) as a parameter
sub new {
my $nym = shift;
my $handle = shift;
my $class = ref($nym) || $nym;
my $self = { %fields, };
open (STDIN, "<&$handle") or client_dies(); # probably wrong
open (STDOUT,">&$handle") or client_dies(); # probably wrong
...
bless $self, $class;
return $self;
}
As is probably obvious, I don't really know what I'm doing, except that I saw
something similar being used in a C server. The Person class is the only use of
OOP in the entire project (probably) and is unlikely to ever have any derived
classes or need inheritance. Perhaps a more knowledgable programmer could help
me out. One instance of Person needs to be able to call a subroutine (based on
some iput from its socket) which in turn sends some output to a different
instance.
Thanks,
Jeeves (darlenem@spamless.flash.net)
--
---------------------------------------------------------------------
J | Copyright (c) 1997 Jeeves Industries Limited.
J | All rights reserved. Void where prohibited.
J | Some restrictions may apply. Limit 1 per customer.
J J | Offer not valid in conjunction with any other offer.
JJJ | Some sold separately. Not intended for children under 3.
---------------------------------------------------------------------
>From .cshrc:
alias rm 'rm -rf \!*'
alias hose kill -9 '`ps -augxww | grep \!* | awk \'{print $2}\'`'
alias kill 'kill -9 \!* ; kill -9 \!* ; kill -9 \!*'
alias renice 'echo Renice\? You must mean kill -9.; kill -9 \!*'
=====================================================================
------------------------------
Date: Tue, 10 Feb 98 00:11:09 +0400
From: "Ben Coleman" <bcoleman@mindspring.com>
Subject: Re: Perl documentation (was re: Perl Year 2000 ...)
Message-Id: <idzmeiqsqwuuryy.pminews@user-38lcp82.dialup.mindspring.com>
On 9 Feb 1998 20:12:53 GMT, Ilya Zakharevich wrote:
>> Is it intended that perldoc -f <function> doesn't page its output, or
>> is that just a problem with the OS/2 port?
>
>It does. With 5.004_55 it will even if you do not have any pager
>around (it uses `cmd /c more').
Odd. On all 3 of the Perls I have access to (5.00401 on OS/2 and
Linux, and the standard Win32 binary distribution), perldoc -f
doesn't page its output, but does page normal POD output. Am I just
holding my mouth wrong?
Ben
--
Ben Coleman NJ8J | The attempt to legislatively
Internet: bcoleman@mindspring.com | micromanage equality results, at
http://bcoleman.home.mindspring.com/ | best, in equal misery for all.
------------------------------
Date: 10 Feb 1998 05:35:54 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl documentation (was re: Perl Year 2000 ...)
Message-Id: <6boovq$4gq$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Ben Coleman
<bcoleman@mindspring.com>],
who wrote in article <idzmeiqsqwuuryy.pminews@user-38lcp82.dialup.mindspring.com>:
> On 9 Feb 1998 20:12:53 GMT, Ilya Zakharevich wrote:
>
> >> Is it intended that perldoc -f <function> doesn't page its output, or
> >> is that just a problem with the OS/2 port?
> >
> >It does. With 5.004_55 it will even if you do not have any pager
> >around (it uses `cmd /c more').
>
> Odd. On all 3 of the Perls I have access to (5.00401 on OS/2 and
> Linux, and the standard Win32 binary distribution), perldoc -f
> doesn't page its output, but does page normal POD output. Am I just
> holding my mouth wrong?
You got me! Indeed, I missed the significance of -f!
Sorry,
Ilya
------------------------------
Date: Mon, 09 Feb 1998 22:17:01 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: Regular expression expander
Message-Id: <34DFC6AE.EB74F828@coos.dartmouth.edu>
Eli the Bearded wrote:
>
> Chipmunk <rjk@coos.dartmouth.edu> wrote:
> > Chipmunk wrote:
> > > the ones I've tried it on so far. Note that it does not handle
> > > Perl's extended regular expression syntax: (?...).
>
> Which includes it not handling non-capturing parens.
Yup. Granted, non-capturing parentheses are useful only for efficiency and
convenience - they don't increase the power of regexes.
My program is more of an interesting toy than a useful program.
> > > Aside from that, feel free to find regexes where it screws up.
>
> At a glance it gets character classes slightly wrong.
>
> : elsif ($c eq '[') { # character class
> :
> : $regex =~ s/^(\^?(?:\\.|[^\]])+)\]//;
>
> $regex =~ s/^(\^?]?(?:\\.|[^]])*)]//;
Thanks, I added that fix in.
(In case you're wondering why all the non-special brackets were backslashed,
it's to keep emacs from getting confused. :-)
> [...]
>
> You also don't seem to handle /x at all.
True. That probably wouldn't be too hard to add. Is it as simple as removing
unescaped whitespace and comments terminated by newlines or the regex delimiter,
or are there tricky constructs I'd have to worry about?
I also don't handle variable interpolation. :-)
Chipmunk
------------------------------
Date: Mon, 09 Feb 1998 22:29:26 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: sorting hash by numeric values
Message-Id: <34DFC997.506929D3@coos.dartmouth.edu>
I have a life, and I can prove it! wrote:
>
> > push @out, printf "%6d%s", $count, $keyword;
> Speaking of which... this line interests me...
>
> Does push bind more tightly than printf? As in, if you gave too many
> arguments to printf, would they be used as elements to push() or just
> discarded? Just a thought...
The second argument to printf is a LIST. You *can't* pass it too many arguments.
You can pass it more arguments than it needs, but you can't pass it too many.
Any unused arguments are discarded by printf.
Chipmunk
------------------------------
Date: 10 Feb 1998 04:17:50 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <6bokde$d5r$1@info.uah.edu>
Following is a summary of articles spanning a 7 day period,
beginning at 03 Feb 1998 04:22:08 GMT and ending at
09 Feb 1998 23:42:38 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" e-mail address and name.
- Original Content Rating is the ratio of the original content volume
to the total body volume.
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
Excluded Posters
================
perlfaq-suggestions\@mox\.perl\.com
Totals
======
Posters: 471
Articles: 1192 (445 with cutlined signatures)
Threads: 396
Volume generated: 1907.5 kb
- headers: 804.2 kb (16,466 lines)
- bodies: 1022.6 kb (31,917 lines)
- original: 716.7 kb (24,260 lines)
- signatures: 79.5 kb (1,627 lines)
Original Content Rating: 0.701
Averages
========
Posts per poster: 2.5
median: 1 post
mode: 1 post - 297 posters
s: 5.3 posts
Posts per thread: 3.0
median: 2.0 posts
mode: 1 post - 131 threads
s: 3.3 posts
Message size: 1638.6 bytes
- header: 690.9 bytes (13.8 lines)
- body: 878.5 bytes (26.8 lines)
- original: 615.7 bytes (20.4 lines)
- signature: 68.3 bytes (1.4 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
53 104.8 ( 40.5/ 55.9/ 44.5) tchrist@mox.perl.com (Tom Christiansen)
48 75.8 ( 33.0/ 32.9/ 22.8) mgjv@comdyn.com.au (Martien Verbruggen)
43 58.8 ( 28.6/ 18.8/ 10.5) chip@pobox.com
39 64.8 ( 29.7/ 35.1/ 20.2) rjk@coos.dartmouth.edu
26 36.7 ( 14.2/ 22.0/ 14.3) aml@world.std.com (Andrew M. Langmead)
24 32.0 ( 17.1/ 14.9/ 9.2) jdporter@min.net
23 38.4 ( 19.2/ 16.8/ 8.3) abigail@fnx.com
22 39.6 ( 15.1/ 24.5/ 16.6) cberry@cinenet.net (Craig Berry)
21 35.3 ( 16.3/ 19.0/ 10.3) Eli the Bearded <*@qz.to>
19 29.7 ( 14.4/ 11.2/ 6.1) joseph@5sigma.com
These posters accounted for 26.7% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
104.8 ( 40.5/ 55.9/ 44.5) 53 tchrist@mox.perl.com (Tom Christiansen)
75.8 ( 33.0/ 32.9/ 22.8) 48 mgjv@comdyn.com.au (Martien Verbruggen)
64.8 ( 29.7/ 35.1/ 20.2) 39 rjk@coos.dartmouth.edu
58.8 ( 28.6/ 18.8/ 10.5) 43 chip@pobox.com
39.6 ( 15.1/ 24.5/ 16.6) 22 cberry@cinenet.net (Craig Berry)
38.4 ( 19.2/ 16.8/ 8.3) 23 abigail@fnx.com
36.7 ( 14.2/ 22.0/ 14.3) 26 aml@world.std.com (Andrew M. Langmead)
35.3 ( 16.3/ 19.0/ 10.3) 21 Eli the Bearded <*@qz.to>
32.0 ( 17.1/ 14.9/ 9.2) 24 jdporter@min.net
29.7 ( 14.4/ 11.2/ 6.1) 19 joseph@5sigma.com
These posters accounted for 27.0% of the total volume.
Top 10 Posters by OCR (minimum of five posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 1.3 / 1.3) 5 Pablo Hortal <mcai3ph2@ist4.co.umist.ac.uk>
1.000 ( 5.4 / 5.4) 6 gabor@vmunix.com (Gabor)
0.970 ( 10.7 / 11.0) 14 fl_aggie@thepentagon.com (I R A Aggie)
0.966 ( 6.7 / 6.9) 5 "V. Chandrasekhar" <vchandra@mail.delcoelect.com>
0.961 ( 3.1 / 3.2) 6 pudge@pobox.com (Chris Nandor)
0.855 ( 3.0 / 3.6) 5 Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
0.831 ( 4.1 / 4.9) 5 pjmone@symbioticinc.com
0.796 ( 44.5 / 55.9) 53 tchrist@mox.perl.com (Tom Christiansen)
0.755 ( 2.2 / 2.9) 8 Vladimir Alexiev <vladimir@cs.ualberta.ca>
0.735 ( 4.9 / 6.7) 10 mwang@alhena.ibk.ml.com (Michael Wang)
Bottom 10 Posters by OCR (minimum of five posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.562 ( 4.5 / 8.0) 5 Jason Christian <jason@primal.ucdavis.edu>
0.558 ( 10.5 / 18.8) 43 chip@pobox.com
0.547 ( 6.1 / 11.2) 19 joseph@5sigma.com
0.544 ( 9.7 / 17.9) 16 efflandt@xnet.com (David Efflandt)
0.543 ( 10.3 / 19.0) 21 Eli the Bearded <*@qz.to>
0.525 ( 1.8 / 3.5) 6 Gellyfish@btinternet.com (Jonathan Stowe)
0.496 ( 8.3 / 16.8) 23 abigail@fnx.com
0.494 ( 1.9 / 3.9) 5 charlot@CAM.ORG (Richard Bellavance)
0.449 ( 2.6 / 5.7) 12 Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
0.424 ( 4.0 / 9.4) 9 Larry D'Anna <ldanna@hotmail.com>
Top 10 Threads by Number of Posts
=================================
Posts Subject
----- -------
29 Is Perl 5 year 2000 compliant?
28 Quickie: regexp for valid e-mail addresses
19 solution for multiline comments???
16 I am female, blonde and stupid!
15 can variables be generated on the fly
14 Don't use signal handlers (was Re: Child processes)
12 Year 2000 Compliance: Lawyers, Liars, and Perl
12 Inverse of a regex
10 Is file locking necessary?
10 Filtering Problem
These threads accounted for 13.8% of all articles.
Top 10 Threads by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Subject
-------------------------- ----- -------
49.4 ( 21.5/ 25.1/ 17.2) 28 Quickie: regexp for valid e-mail addresses
47.5 ( 24.6/ 20.9/ 12.5) 29 Is Perl 5 year 2000 compliant?
34.8 ( 9.5/ 24.0/ 19.7) 12 Year 2000 Compliance: Lawyers, Liars, and Perl
33.9 ( 14.3/ 18.1/ 8.7) 19 solution for multiline comments???
25.6 ( 11.7/ 12.2/ 8.3) 14 Don't use signal handlers (was Re: Child processes)
22.8 ( 10.6/ 10.5/ 5.8) 15 can variables be generated on the fly
20.8 ( 8.8/ 11.6/ 8.0) 10 Tie-Dee-Perl (Cleanliness is next to Goodliness, or Perl-White Code)
19.7 ( 6.7/ 10.6/ 7.7) 10 Filtering Problem
19.4 ( 5.8/ 13.3/ 7.3) 9 Good Perl editors
19.3 ( 10.9/ 7.4/ 5.1) 16 I am female, blonde and stupid!
These threads accounted for 15.4% of the total volume.
Top 10 Threads by OCR (minimum of five posts)
==============================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.876 ( 5.5/ 6.2) 6 returning the date
0.842 ( 7.2/ 8.5) 7 A Scoping Related Question
0.837 ( 3.8/ 4.5) 5 A problem - please help
0.829 ( 4.1/ 4.9) 5 print a integer with two decimal places
0.824 ( 3.6/ 4.3) 5 Generic Config-file maintenance
0.820 ( 19.7/ 24.0) 12 Year 2000 Compliance: Lawyers, Liars, and Perl
0.785 ( 2.2/ 2.8) 5 Array of Records
0.781 ( 4.1/ 5.3) 7 Perl in a datawarehouse environment
0.755 ( 7.3/ 9.6) 9 killing a child process after a timeout
0.748 ( 7.1/ 9.4) 7 quick .signature hack
Bottom 10 Threads by OCR (minimum of five posts)
=================================================
(kb) (kb)
OCR orig / body Posts Subject
----- -------------- ----- -------
0.494 ( 2.3 / 4.6) 8 recursive regex?
0.490 ( 2.1 / 4.2) 9 Syntax-coloring editor for NT
0.483 ( 8.7 / 18.1) 19 solution for multiline comments???
0.483 ( 0.7 / 1.4) 5 Survival Of perl
0.476 ( 1.2 / 2.5) 5 Error with analysis of system () return value on Perl book page 230
0.472 ( 1.5 / 3.1) 6 Win32 CGI compiler ?
0.428 ( 2.3 / 5.4) 7 Help! 255-char URL limit passing form values to cgi
0.400 ( 1.9 / 4.7) 6 Crazy Idea
0.387 ( 1.9 / 4.9) 6 New core dump on long-working troff2html
0.367 ( 1.2 / 3.3) 6 A regex problem
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
39 comp.software.year-2000
37 comp.lang.perl.modules
24 alt.fan.e-t-b
8 comp.lang.javascript
5 comp.unix.solaris
5 comp.lang.perl
4 comp.lang.java.programmer
4 comp.lang.java.misc
4 comp.lang.c++
4 alt.perl
Top 10 Crossposters
===================
Articles Address
-------- -------
24 "Webmaster" <webmaster@mercdatasys.com>
21 Eli the Bearded <*@qz.to>
14 jackson@usenix.org (Jackson Dodd)
12 "Manfred Schneider" <manfred.schneider@rhein-neckar.de>
9 mst@fadavis.com (Mike Torrence)
7 tchrist@mox.perl.com (Tom Christiansen)
5 abigail@fnx.com
4 aml@world.std.com (Andrew M. Langmead)
4 "Murali Kazhipurath" <murali@jps.net>
4 mgjv@comdyn.com.au (Martien Verbruggen)
------------------------------
Date: Mon, 09 Feb 1998 23:45:36 -0500
From: Larry D'Anna <ldanna@hotmail.com>
Subject: Re: Syntax-coloring editor for NT
Message-Id: <34DFDB70.D469CA56@hotmail.com>
Andy Lester wrote:
>
> : Why pay $100 for some silly little MultiEdit when
> : GNU Emacs is free and _much_ beter?
>
> Because I hate Emacs.
Then use vi, or vim or some other _free_ editor.
> Why give someone shit for espousing an opinion? Go find someone who
> cares.
Buying proprietary software is almost understandable when a free
equivalent is not available, but paying $100 for a text editor is
ridiculous. As long as people like you keep buying their crap,
people like Microsoft will continue to screw the rest of us.
---------------------------------------------------
|Democracy is the worst system of government. --
|Except for all the others
| -Winston Churchill
---------------------------------------------------
Larry D'Anna "eschew obfuscation"
------------------------------
Date: Mon, 09 Feb 1998 20:15:48 +0000
From: Brandon Blum <bblum@earthlink.net>
Subject: test!! please ignore this message i am seeing if it works!
Message-Id: <34DF63F3.79842BE2@earthlink.net>
never done a newsgroup before, trying to learn perl and i want to post,
hopefully this works, just ignore it!
Brandon
------------------------------
Date: Tue, 10 Feb 1998 03:00:01 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: The 'study' function
Message-Id: <Eo5701.8zv@world.std.com>
spidaman@well.com (Ian Kallen) writes:
>I have yet to see in code or literature use of the 'study' function (I was
>hoping the 'Effective Perl' book would touch on it, but it's still an
>excellent book)... I'm looking for a good example (like with the Benchmark
>module :) of benefits from 'study'
According to the book "Mastering Regular Expressions" study() has been
broken in in recent releases of perl. I haven't tested this myself
though, so you might want to check for yourself.
The purpose that it serves, though, is to optimize constructs like the
following. It only works for certain types of input, (if certain
characters that you are trying to match on are uncommon characters in
the string.) so you really need to bechmark it agains a representive
data set to see if there is any improvement or not.
sub return_match_if_found {
my $string = shift;
study $string; # find the common characters in $string
return 'foo' if /foo/;
return 'bar' if /bar/;
return 'baz' if /baz/;
return 'qux' if /qux/;
return 'quux' if /quux/;
return;
}
--
Andrew Langmead
------------------------------
Date: Tue, 10 Feb 98 00:44:36 +0400
From: "Ben Coleman" <bcoleman@mindspring.com>
Subject: Re: The Specified module can not be found.
Message-Id: <vnuyazlswjkveyc.pminews@user-38lcp82.dialup.mindspring.com>
On Fri, 6 Feb 1998 19:01:26 -0000, Stuart Grimshaw wrote:
>I keep getting the above error message every time I request a perl script
>from my server, (NT W/s running IIS4 beta 2).
>
<snip simple perl script>
>The script works fine if run from a DOS box, so why do I keep getting that
>error in my browser?
Your perl script doesn't use any modules, which leads me suspect that
the message is coming from IIS4, and that your perl script isn't even
getting run. I know nothing about IIS, though. You might want to
check any docs provided with IIS, or pop over to
comp.infosystems.www.servers.ms-windows and find out what IIS means
by that message(perhaps you don't have it correctly configured to run
perl scripts?).
Ben
--
Ben Coleman NJ8J | The attempt to legislatively
Internet: bcoleman@mindspring.com | micromanage equality results, at
http://bcoleman.home.mindspring.com/ | best, in equal misery for all.
------------------------------
Date: 10 Feb 1998 03:26:46 GMT
From: jdavitt@ripco.com (J.M. Davitt)
Subject: Re: Year 2000 Compliance: Lawyers, Liars, and Perl
Message-Id: <6bohdm$juk$1@gail.ripco.com>
Yeah, it's hard to believe, but the internal data representation
was driven by the century-old hollerith code. The machines did
arithmethic on zoned decimal data. Packed data wouldn't save
anything in a field this small, and binary was awkward -- often
because the real arithmetic instruction set was a very costly
option. Remember when the 80387 was an option? Same thing.
Not only did we elide the two century digits: months were often
coded from the set "one through nine, skip, jay, kay" -- the
last being `-', `J', and `K'.
Anything to save a byte. Or, often more importantly, a column
on a unit record card.
: I'm still thinking about the issue of people learning bad
: habits from the bad old days of Cobol.
Those who endured Latin classes recognize the adapted:
COBOL is a language
dead as it can be.
First it killed 360s,
now it's killing me.
But, really, what bad habits are endemic to the language? I've
seen folks cobble up _lots_ of languages.
------------------------------
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 1843
**************************************