[7897] in Perl-Users-Digest
Perl-Users Digest, Issue: 1522 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 22 12:07:22 1997
Date: Mon, 22 Dec 97 09: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, 22 Dec 1997 Volume: 8 Number: 1522
Today's topics:
Re: calling two arrays in a function as variables (Tad McClellan)
Camel Critiques: PERL: THE PROGRAMMER'S COMPANION <tchrist@mox.perl.com>
Re: Compilation error with Format (Tad McClellan)
Compiling Perl as an executable <prv@FormalSys.CA>
Re: Expect <webmaster@fccj.cc.fl.us>
Re: Help with pattern matching please? (Bart Lateur)
Re: HELP! Bitwise XOR (^) doesn't work on strings? <merlyn@stonehenge.com>
Re: HELP: Incredibly easy question that I just cannot f <camerond@mail.uca.edu>
Re: HELP: Incredibly easy question that I just cannot f <camerond@mail.uca.edu>
Mini Critiques <tchrist@mox.perl.com>
Mod Perl msaiju@giasbga.vsnl.net.in
Re: ORAPerl (Mike Stok)
Perl Module for RCS <freter@freter.com>
Re: perl4 -> perl5 upgrade - problems with db (M.J.T. Guy)
persistent DBI connection in Apache perl_mod avivc@amdocs.com
post method - perl cgi communicates with java applet <mehta@mama.indstate.edu>
Re: Read in Mailfolder <kjj@pobox.com>
Re: redirection on win95 <ophiry@agentsoft.com>
Regex problem in 5.004_04 ? (regexp *+ operand could be S.Petersen@usa.net
Re: Regex problem in 5.004_04 ? (regexp *+ operand coul (Honza Pazdziora)
Re: Reset of the 'each' function with the assignment op (M.J.T. Guy)
test don't read <whittaa1@hau112.ha.uk.sbphrd.com>
Re: Which language pays most 17457 -- C++ vs. Java? (Billy Chambless)
Re: Which language pays most 17457 -- C++ vs. Java? <steve@seasoned-software.com>
Win32 problem with ISAPI (PERLISS.DLL ) apps not workin a@b.c
Re: WWW database <ebohlman@netcom.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 22 Dec 1997 08:11:32 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: calling two arrays in a function as variables
Message-Id: <kesl76.2o.ln@localhost>
Honza Pazdziora (adelton@fi.muni.cz) wrote:
: Aragorn <mbijlsma.nospam@xs4all.nl> writes:
: > Hi,
: > I've got a problem calling two lists or arrays into a function. When I
: > call them inside the function using (@foo, %bar) = @_; perl tends to
: > assign all elements - both arrays - to the first one, leaving the second
: [...]
: > won't work.
: > Is there any special syntax forcing perl to keep the two devided, any
: > trick to get the arrays back in line, just.. anything that will work? :)
: It's documented in the docs. You need to pass references to those
: objects -- two scalars:
So far I've seen two followups that refer you to the docs.
But you may still wonder where in those hundreds of pages of docs
it is.
It is in 'perlsub', where it says:
-----------------------------------
The Perl model for function call and return values is simple: all
functions are passed as parameters one single flat list of scalars, and
all functions likewise return to their caller one single flat list of
scalars. Any arrays or hashes in these call and return lists will
collapse, losing their identities--but you may always use
pass-by-reference instead to avoid this.
-----------------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 22 Dec 1997 15:26:23 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Camel Critiques: PERL: THE PROGRAMMER'S COMPANION
Message-Id: <67m0qv$2gq$1@csnews.cs.colorado.edu>
Title: Perl: The Programmer's Companion
Author: Nigel Chapman.
ISBN: 0-471-97563-X.
Publisher: John Wiley & Sons
Size: 268pp
Price: $29.95
Rating: 5 out of 5
I give this work five camels. Yup, that's what I said; I may be waxing
overly ecstatic and perhaps shall renege later. I've only spot checked
it so far, but with delight. But it sure looks terrific. Everything I
looked at was right on the money technically, even scoping, which no
one ever ever gets right.
The book was written by a fellow from in the UK. It's a tiny, no frills,
no crap book designed for programmers by one of their own, with a touch of
whimsey thrown in. Malcolm Beattie, release manager for 5.005 and author
of the Perl code-generator, was the technical reviewer. The English is
well-formed, perhaps even literate. It doesn't talk down to its audience,
nor does it confuse them with distracting layout gimmicks.
This book is a pleasure to read.
The epilogue is really worth raving about. I can't repro it here.
It's a coffee shop dialogue on theory versus practice, and what we
programmers have been doing wrong a long time. I almost wonder whether
Larry wrote it pseudonymously. :-)
BEGIN_CITE: (some elisions)
The aim of this book is to introduce programmers to Perl, and Perl
to programmers. It offers an invitation to look at a programming
language that is different from the everyday ones, and can save you
an awful lot of time and programming effort. [...]
P:TPC is not a tutorial on computer programming. It is a book aimed
at people who already know something--possibly quite a lot--about
programming, and at least a little about computer science. [...]
I also assume that you enjoy programming computers, even if you find
that these days you don't have much time for the enjoyable bits.
P:TPC differs from most other offerings on the same subject by
being written by someone who doesn't mind being described as a
computer scientist. It is customary for computer scientists to
treat Perl as an aberration and to ignore it as much as possible.
Perl enthusiasts, for their part, tend to treat computer scientists
with scorn, and accuse them of being detached from the real world,
and generally no fun.
I hope that this book may do something to reconcile the two factions,
by showing that Perl is a worthy object of anyone's attention, and
that a broader computer science viewpoint can provide some context
for understanding and making judgements about Perl.
There appear to be two views of what Perl is. One school of thought,
based on the fact that Perl was born to Unix, inherits many features
from the Unix shells and tools like sed and awk, and has a high level
of support for interacting with that operating system built in to it,
holds that it is primarily a Unix system administration tool.
The other school of thought holds that Perl is a general-purpose
programming languages, whose slightly unusual nature should not
prevent it being taken as seriously as C++, Modula-3, or Java.
This book is based on the second view.
END_CITE
In short, I like this book.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
If I had to choose between System V and 4.2, I'd resign. --Peter Honeyman
------------------------------
Date: Mon, 22 Dec 1997 08:50:01 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Compilation error with Format
Message-Id: <pmul76.2r.ln@localhost>
Eric Bohlman (ebohlman@netcom.com) wrote:
: Randy <randx@imagin.net> wrote:
: : Thanks Tom, you were right on the money.
: : I just logged back in to answer my own question, and you were
: : right. I did not have an end of line after the peiod, at the end
: : of the fille. Adding a return after the period fixed my problem.
: : Lesson one. Remember that last CR at the end of the file, for
: : format statements and data, especially.
: Corrolary to lesson one: because human-generated text files often leave
: out the newline on the last line, even though they're supposed to have
: it, make sure that any programs you write can deal with this when reading
: text files. In particular, chop() is not reliable when used on lines
: from human-generated text files. Use chomp() instead.
... and test with defined() when reading text files.
while (defined($text = <TEXT>))
in case the final incomplete line happens to be 0 (zero)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 22 Dec 1997 09:49:39 -0400
From: Paul Vermette <prv@FormalSys.CA>
Subject: Compiling Perl as an executable
Message-Id: <349E6FF3.7700278@FormalSys.CA>
I was wondering if there is any way to compile perl to an executable...
I know there is a perl to exe program for the win32 architecture.. but
I am looking for a way to compile the scripts on the UNIX platform..
Is there maybe a perl2c program or something to that degree?
Thanks..
---
email: prv@formalsys.ca
------------------------------
Date: Mon, 22 Dec 1997 08:42:57 -0500
From: "Bill Jones, FCCJ Webmaster" <webmaster@fccj.cc.fl.us>
To: Nils Sowen <webmaster@rhein-ruhr.de>
Subject: Re: Expect
Message-Id: <349E6E60.38533B81@fccj.cc.fl.us>
This is a multi-part message in MIME format.
--------------6DA0AA3E6AF39ED49DCCB756
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Nils Sowen wrote:
> Hello,
>
> I read your news-article from 1997/12/18 ...
>
> Where can I get this "Expect" program for Perl ? I need
> to execute a C-Binary via Perl, which adds passwords to
> a password file (not /etc/passwd). This passwordfile is
> root-only readable/writeable.
>
> Can I do this with "Expect" ?
>
> Bye
> Nils
>
> --
>
> | Nils Sowen, Webmaster nsowen@rhein-ruhr.de |
> | of Rhein-Ruhr.De, Freepage.De webmaster@rhein-ruhr.de |
> | |
> | URL : http://www.rhein-ruhr.de/nsowen |
> | s-mail: Oemberg 67, 45481 Muelheim/Ruhr |
> | phone : +49-208-466197 * fax +49-208-482450 |
Expect is not a Perl Module - Expect is, like Perl, a
completely independent development language. It can be found
at http://expect.nist.gov/ It was written by Don Libes as a way to
fully automate software testing :-) It can do things that Perl cannot
(which, to be honest, is to say it can automate certain things which
would be harder to do in Perl.)
It cannot 'break into' your system (not unless your security is all
wrong.)
So, as far as accessing root-only readable/writable stuff - you are
still
going to need to be root :-)
If you are on Unix, then you should be able to use 'htpasswd'
(available from http://www.apache.org) to do what you want in that
respect - unless you are rolling your own security - in which
case you probably should have done it all in Perl anyways... :-)
You should still be able to use Perl to 'call/execute' the C binary,
without being root (or at least setting up proper permissions on the
appropriate password file(s)) that is not much you will be allowed to
do either with Perl or Expect. You will need to be able to
become root.
You will need to have root accesss to even install expect anyways :-(
Sorry I could not be more helpful,
Bill
--------------6DA0AA3E6AF39ED49DCCB756
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Bill Jones
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Bill Jones
n: Jones;Bill
org: FCCJ
adr: 501 W. State St.;;MCCS Rm. 270;Jacksonville;FL;32202;USA
email;internet: webmaster@fccj.cc.fl.us
title: Webmaster
tel;work: (904) 632-3089
tel;fax: (904) 632-3007
tel;home: Pager: 1 (904) xxx-xxxx
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard
--------------6DA0AA3E6AF39ED49DCCB756--
------------------------------
Date: Mon, 22 Dec 1997 15:46:53 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Help with pattern matching please?
Message-Id: <349e8af9.2375616@news.tornado.be>
Chipmunk <rjk@coos.dartmouth.edu> wrote:
>Um... Your "neat" solution is simply another way of doing what you were
>just discussing:
>
>$_ = ".Chr";
>$_ = "\Q$_\E";
Yup. TIMTOWTDI. I think it's neater then manually adding the backslashes
yourself. But that's all, eally (except that it's Perl4-compatible, too;
"\Q" is new for Perl5).
Bart.
------------------------------
Date: 22 Dec 1997 09:42:08 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: HELP! Bitwise XOR (^) doesn't work on strings?
Message-Id: <8cvhwhnxcv.fsf@gadget.cscaper.com>
>>>>> "Bart" == Bart Lateur <bart.mediamind@tornado.be> writes:
Bart> Now, much to my suprise, { chop("12A0") } and { chr(48) } both are
Bart> considered to be FALSE, although they're neither the null string nor 0.
The number 0 and the string "0" are equivalent. chr(48) is "0".
So is chop($a = "12A0"). (You can't chop a literal string, so
we assign to a dummy variable first.)
The way I teach it in my classes is the following:
(1) evaluate the to-be-tested value in a scalar context
(2) if it's a number, convert it to a string
(3) if it's "" or "0", it's false. Everything else is true.
That's not exactly right (the #2 step is actually optimized), but this
rule is pretty easy to remember.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 252 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 22 Dec 1997 09:47:04 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: HELP: Incredibly easy question that I just cannot find the answer to!
Message-Id: <349E8B78.4D328E31@mail.uca.edu>
James East wrote:
>
> Replies to e-mail would be appreciated. Thanks a lot.
>
> James East
Funny, I didn't get an e-mail from you, it just showed up in the
newsgroup. Please check your mail program, must be broken.
Cameron Dorey
camerond@mail.uca.edu
------------------------------
Date: Mon, 22 Dec 1997 09:47:28 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: HELP: Incredibly easy question that I just cannot find the answer to!
Message-Id: <349E8B90.C2C942E7@mail.uca.edu>
James East wrote:
>
> Replies to e-mail would be appreciated. Thanks a lot.
>
> James East
Funny, I didn't get an e-mail from you, it just showed up in the
newsgroup. Please check your mail program, must be broken.
Cameron Dorey
camerond@mail.uca.edu
------------------------------
Date: 22 Dec 1997 15:47:49 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Mini Critiques
Message-Id: <67m235$4au$1@csnews.cs.colorado.edu>
1. The Perl 5 Programmer's Reference
published by Ventana; 424pp, hardcover.
This book presents all Perl functions and operators in alphabetical
order, complete with examples and side-text. Consider it as an
expanded perlfunc and perlmodlib manpage. It's clean and reasonably
small, and isn't full of glossy noise. That's the good news.
The bad news is that it gets a lot of code wrong. There are numerous
technical mistakes throughout, little new knowledge, and prose that
is at best functional, not delightful. RATING: 2 out of 5 camels.
2. Perl CGI Programming, No Experience Required
by Erik Strom; 429pp
This mostly-perl4 book is a bit noisy in its layout. Its intended
audience is the technically inexperienced trying to get a start
with programming, via that perversely ubiquitous gateway to the
same, CGI. Its code layout uses the pessimal bracing notation,
which is distracting at best. Its technical errors are at time
egregious. To give just a flavor of this, it calls the st_ino
field in the stat structure of a file the "number of inodes used".
Its example of the oct() function is $mode = oct(0666), if you can
possibly believe that. Its hit counters don't use file locking,
and propagates the form-reading bug caused by careless programming
by people who will not use the standard modules. RATING: 1 out
of 5 camels.
3. Advanced Perl Programming,
published by O'Reilly.
RATING: 4 Camels.
4. Perl for Dummies;
RATING: 1 Camel.
--
Tom Christiansen tchrist@jhereg.perl.com
if (shm == (char *)-1) /* I hate System V IPC, I really do */
--Larry Wall, from doio.c in the v5.0 perl distribution
------------------------------
Date: Mon, 22 Dec 1997 10:21:22 -0600
From: msaiju@giasbga.vsnl.net.in
Subject: Mod Perl
Message-Id: <882807550.488308740@dejanews.com>
Hi,
I installed mod_perl for solaris and tried to use it
I did the following
a) Added the following at srm.conf
Alias /perl/ /usr/local/etc/httpd/mod
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
</Location>
b) Wrote the following CGI (/usr/local/etc/httpd/mod/test.mod)
$r->print "Content-type: text/html\n\n";
$r->print "Date: ", scalar localtime, "\n";
$r->print "%ENV: \n", map { "$_ = $ENV{$_} \n" } keys %ENV;
c) Set the document root to /usr/local/etc/httpd.
d) Run the httpd which had mod_perl support.
I then tried to "Run" the scipt by giving http://localhost/mod/test.mod
The script was displayed in the browser (than the output of the script)
Does anyone know what is happening?
Thanks in Advance
Bye
BAIJU PAUL
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 22 Dec 1997 14:14:06 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: ORAPerl
Message-Id: <slrn69stic.ph.mike@stok.co.uk>
On Mon, 22 Dec 1997 11:32:52 +0100, Jan Peyer <jan.peyer@be.softlab.ch> wrote:
>Does someone can tell me where i can find somethings about ORAPerl for
>Perl V. 5.004
Perl 5uses modules to interface to databases, there's a system which uses
a common frontend (DBI - database interface) with back ends tailored to
particular engined (DBD - database drivers.) I haven't used th Oracle
DBD, but believe that it has ORAPerl emulation. You can read about the
drivers at http://www.hermetica.com/technologia/perl/DBI/ and get ther
modules by following links there or visiting a CPAN site (Comprehensive
Perl Archive Network, master site at ftp.funet.fi under
/pub/languages/perl/CPAN and widely mirrored.)
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Mon, 22 Dec 1997 14:03:31 GMT
From: Craig Freter <freter@freter.com>
Subject: Perl Module for RCS
Message-Id: <349E7351.B5C@freter.com>
A recent programming project required the creation of a Revision Control
System (RCS) front end. I started with inline system calls to the RCS
utilities, and by creating multiple parsing functions to extract
information
from an RCS archive file.
I then decided to put all my functions in one place, and created Perl
module
Rcs.pm.
The next step was to change my functions into object methods, and Rcs.pm
became object oriented.
This Perl module should be of interest to anyone creating an RCS front
end.
Here's a quick and dirty example of how to check in a file.
use Rcs;
$obj = Rcs->new;
$obj->file('testfile.pl');
# Set RCS archive directory, is './RCS' by default
$obj->rcsdir("./project_tree/archive");
# Set working directory, is '.' by default
$obj->workdir("./project_tree/src");
$obj->ci('-mRevision Comment');
Full documentation may be found at
http://www.freter.com/perl/Rcs/Rcs.html
If there's any interest, I would like to make Rcs.pm publicly available.
Please let me know is you have any suggestions or comments.
--
Craig Freter <freter@freter.com> <http://www.freter.com>
PGP fingerprint 61 A5 E2 51 F5 AC 9D 79 DD 15 56 90 F2 0A 97 25
Heorot Systems <http://www.heorotsi.com>
------------------------------
Date: 22 Dec 1997 16:31:43 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: perl4 -> perl5 upgrade - problems with db
Message-Id: <67m4lf$egl$1@lyra.csx.cam.ac.uk>
Anthony David <adavid@netinfo.com.au> wrote:
>Christian Bruegmann wrote:
>> I want to upgrade from perl4.018 to perl5.004.
>>
>> My Problem is that i have about 200 databases (dbm with .pag and .dir).
>> My new Version of Perl seems to use an other type of databases - there
>> is no .pag and .dir ending anymore. That will be ok - because the old
>
>Could you please be more specific here. Do you have any examples?
>
>> scripts will work - but i can't open the new type with my old "dbmopen
>> (...)" - - where can i set the type of the used database ????
>>
>
>check out
>
> perldoc -f tie
>and
> perldoc DBM
>
>There are a number of different xDBM packages supported, they should all
>use
>.dir & .pag though.
Nope. Some of them use a single file. And the formats are all different.
I suspect the original poster is suffering from the problems mentioned
in perltrap under "DBM traps". Perl4 and Perl5 use different rules
to choose the default xDBM to use. You'll probably need to
override the Perl5 default.
Mike Guy
------------------------------
Date: Mon, 22 Dec 1997 09:41:16 -0600
From: avivc@amdocs.com
Subject: persistent DBI connection in Apache perl_mod
Message-Id: <882803801.308805637@dejanews.com>
I'm trying to get a persistent database connection in Apache perl_mod. I
added PerlModule Apache::DBI to my httpd.conf file and done everything by
the book. Not as I expected, I get a new DBI connection for every HTTP
request. Any ideas?
I'm using:
Apache server 1.2.4
Perl 5.004_01
DBI 0.85
mod_perl 1.07
Apache:DBI 0.76
Thanks.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Mon, 22 Dec 1997 03:56:34 GMT
From: Miten S Mehta <mehta@mama.indstate.edu>
Subject: post method - perl cgi communicates with java applet
Message-Id: <Pine.LNX.3.96.971221225227.5277A-100000@mama.indstate.edu>
12/21/97
Hello,
I have a perl cgi communcating with java applet with content-type as
text/plain. I use urlconnection class from java to do communication. I
want to enable the cgi now to drop cookies but I do not know if thats
possible due to the urlconnection class.
could you guide?
-miten
------------------------------
Date: 22 Dec 1997 07:17:03 -0700
From: Kevin Johnson <kjj@pobox.com>
Subject: Re: Read in Mailfolder
Message-Id: <m2vhwho41k.fsf@pobox.com>
tpuck@usa.net (Puck) writes:
> Can someone give me a script that shows how to read in
> /var/spool/mail/root or /var/spool/mail/user_name ?
>
> Please don't make it to complicate because I'm new at perl !
Depending on what you want to do, you might want to check CPAN for
Mail::Folder.
It doesn't support reading mail in the system mail spool directory,
but works well enough for mail folders in general.
The documentation says why it doesn't support system mail spool
directories. I'm in the 'abolish the system mail spool forever' camp.
--
thx,
kjj@pobox.com http://www.pobox.com/~kjj/
------------------------------
Date: Mon, 22 Dec 1997 15:38:48 +0200
From: Ophir Yoktan <ophiry@agentsoft.com>
Subject: Re: redirection on win95
Message-Id: <349E6D68.812703ED@agentsoft.com>
Creede Lambard wrote:
> This may have three causes. Well, I suppose you could throw in evil spirits
> and bugs in Perl, but I don't consider either one very likely to cause
> problems like this.
>
...
> Hope this helps,
>
> --- Creede Lambard
> Minister of Irregular Expressions
> Programming Republic of Perl
it's none of the above.
redirection from the command line does work - it fails only from perl
-----------------------------
Ophir Yoktan
ophiry@agentsoft.com
http://www.huji.ac.il/~ophiry
"It's not a bug, It's a feature"
(old Microsoftian proverb)
------------------------------
Date: Mon, 22 Dec 1997 09:21:32 -0600
From: S.Petersen@usa.net
Subject: Regex problem in 5.004_04 ? (regexp *+ operand could be empty)
Message-Id: <882803318.312868874@dejanews.com>
Hi,
when I'm using the following regex from the Perl FAQ with my copy of
5.004_04 (Linux, i586), I get the error
Uncaught exception from user code:
/ < # opening angle bracket
(?: # Non-backreffing grouping paren
[^>'"] * # 0 /: regexp *+ operand could be empty at
../regexprob.pl line 17.
I couldn't find any hint that this is a known problem with 5.004_04, could
somebody shed some light on what could be going on?
Here's the code:
#!/usr/bin/perl -w
use diagnostics;
use strict;
while (<>) {
s{ < # opening angle bracket (?: # Non-backreffing grouping
paren [^>'"] * # 0 or more things that are neither > nor ' nor
" | # or else ".*?" # a section between double quotes (stingy match)
| # or else '.*?' # a section between single quotes (stingy match)
) + # all occurring one or more times > # closing angle bracket
}{}gsx; # replace with nothing, i.e. delete
print;
}
Thanks in advance for any pointers!
All the best,
Stephan
S.Petersen@usa.net
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Mon, 22 Dec 1997 16:04:08 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Regex problem in 5.004_04 ? (regexp *+ operand could be empty)
Message-Id: <adelton.882806648@aisa.fi.muni.cz>
S.Petersen@usa.net writes:
[..]
> Uncaught exception from user code:
> / < # opening angle bracket
> (?: # Non-backreffing grouping paren
> [^>'"] * # 0 /: regexp *+ operand could be empty at
> ../regexprob.pl line 17.
[...]
> s{ < # opening angle bracket (?: # Non-backreffing grouping
> paren [^>'"] * # 0 or more things that are neither > nor ' nor
> " | # or else ".*?" # a section between double quotes (stingy match)
> | # or else '.*?' # a section between single quotes (stingy match)
> ) + # all occurring one or more times > # closing angle bracket
> }{}gsx; # replace with nothing, i.e. delete
>
> print;
I assume your lines got strange but since I have high error recovery
ratio, I'll continue ;-)
The problem is that your code says in fact ([something]*)+ which is
probably not what you want. Positive number of zeroes occurences is
this zero, so that plus doesn't make sense with combination of star.
So you probably want to change your line [^>'"] * to [^>'"] +. If
there is nothing to fit it, the regexp engine will go to the single
and double quote section, so you do not say if there is nothing to be
found, OK, go for next round (which would probably end up with the
same conclusion).
Hope this helps,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 22 Dec 1997 16:37:51 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Reset of the 'each' function with the assignment operator '=' ?
Message-Id: <67m50v$el8$1@lyra.csx.cam.ac.uk>
In article <3496f319.1675294456@news.istar.ca>, <kboutin@magi.com> wrote:
>I am getting confused about the behaviour of the 'each' function combined
>with the assignment '=' operator. The "each iterator" of a hash seem to
>get reset if this hash is assigned subsequently to something in a list
>context (e.g.: to an @array or to a %hash). I thought that only a call to
>the "keys" function could reset this iterator (that and a complete
>sequence through the elements of the hash with each)! Is there a
>description of this "behavior" in the standard documentation (Camel book,
>Panther Book, ...)? Anyone has an explanation?
Extract from perldoc -f each:
There is a single iterator for each hash, shared by all each(),
keys(), and values() function calls in the program; it can be reset by
reading all the elements from the hash, or by evaluating C<keys HASH> or
C<values HASH>.
In particular, %b = %a; counts as "reading all the elements from the hash".
Mike Guy
------------------------------
Date: 22 Dec 1997 14:42:37 +0000
From: Alex Whittaker <whittaa1@hau112.ha.uk.sbphrd.com>
Subject: test don't read
Message-Id: <vorg1nlqw0y.fsf_-_@hau112.ha.uk.sbphrd.com>
123
-- Alex Whittaker --
SmithKline Beecham Pharmaceuticals
New Frontiers Science Park Alex_Whittaker-1@sbphrd.com
Harlow, CM19 5AW All I know is that I know nothing
------------------------------
Date: 22 Dec 1997 14:55:48 GMT
From: billy@cast.msstate.edu (Billy Chambless)
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <67lv1k$2bq$2@nntp.msstate.edu>
In article <349d7218.98517020@news.ntslink.net>, dgrove@ntslink.net (David Grove) writes:
|> I should point out that these languages pay more because it's hard to
|> find people who would stoop so low as to work with them. :)
|> >Craig A. Johnston wrote:
|> >> COBOL. COBOL pays the most. Get to it, son.
|> >This is not strictly true - MUMPS pays even more than COBOL.
|> >However, there are more COBOL positions available (but it makes
|> >no difference, since you'll never find an unemployed MUMPS or COBOL
|> >programmer).
clueless kids argue
which language is the best one
show me the money
Java, C or Perl
TK/tcl or scripts
show me the money
Ada or c plus plus
FORTRAN or even COBOL
show me the money
Financial reward:
sexier than aesthetics
show me the money.
------------------------------
Date: Sun, 21 Dec 1997 08:45:28 -0800
From: steve <steve@seasoned-software.com>
To: David Grove <dgrove@ntslink.net>
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <349D47A8.E382523@seasoned-software.com>
This is a multi-part message in MIME format.
--------------790B6A3B00565CD844631A4E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
David Grove wrote:
> I should point out that these languages pay more because it's hard to
> find people who would stoop so low as to work with them. :)
>
> >Craig A. Johnston wrote:
> >>
> >> COBOL. COBOL pays the most. Get to it, son.
> >
Some people programming PB,VB,VC,C,C++ make a LOT more than the average
COBOL programmer, and some make less!
> >This is not strictly true - MUMPS pays even more than COBOL.
> >However, there are more COBOL positions available (but it makes
> >no difference, since you'll never find an unemployed MUMPS or COBOL
> >programmer).
> >
> >Gary
> >--
> >"I kicked the perl habit, and so can you. Ask and I'll show you how."
> >
> >pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
> >Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
--------------790B6A3B00565CD844631A4E
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for steve
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: steve
n: ;steve
org: SEASONED SOFTWARE
email;internet: steve@seasoned-software.com
note: notes would be here!
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard
--------------790B6A3B00565CD844631A4E--
------------------------------
Date: Mon, 22 Dec 1997 15:02:13 GMT
From: a@b.c
Subject: Win32 problem with ISAPI (PERLISS.DLL ) apps not working with anything more than basic syntax
Message-Id: <349e80f1.26859091@news.compuserve.com>
Hi - I have implemented the actviestate Perl Win32 distribution,
including the ISAPI component, which runs applications fine from the
command line ( I have verified that the correct versin of perl is
being picked up ie. not one from the Resource Tool kit etc. ) - what I
have a problem with is that the same application fails with an error
like:
Internet Explorer cannot open the internet site abc/dfdf.pl
the operation completed successfully. - when being run as an ISAPI
application!
Code:
use File::Find;
print "Content-type: text/html\n\n";
find(sub {push(@dirlist, $File::Find::name) if -d;}, '/temp');
print <<BUNCHASTUFF;
<HTML><HEAD>
<TITLE>Blah BLah </TITLE>
</HEAD><BODY>
<H1>What's Happening </H1>
<HR>
BUNCHASTUFF
if ($ENV{'PERLXS'} == 'PerlIS'){
print "This is running PerlIS\n";}
print "start", "\n \n";
foreach $item ( @dirlist ) {
print "$item", "\n";
}
print </BODY></HTML>
exit;
The code works if you take the "find " line out - yet this work
perfectly at the command line with no change ( so it is not a syntax
error etc ).
Any suggestions gratefully received.
Cheers.
------------------------------
Date: Mon, 22 Dec 1997 12:56:44 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: WWW database
Message-Id: <ebohlmanELLDAK.8Iv@netcom.com>
[posted and mailed]
Samuel Costa Bendicho <sc1334@speedy.udg.es> wrote:
: I have to design a web with a little database accessible through CGI
: I had in mind using Perl. Do you know what kind of database should I
: use?
Perl is certainly an appropriate language for what you're trying to do.
What kind of database engine you'll want to use will depend on things like:
1) The size of the database. Is it going to be a few hundred records, a
few thousand, or millions?
2) What other programs, if any, need to access the database.
3) What platform the engine needs to run on.
: I'd like to know if there exist some kind of perl libraries to work with
: some standard type of database.
Yes, there are many. Go over to <http://www.perl.com/CPAN/> and take a
look at the listing. If your database is going to have at most a few
thousand records, I'd look into sprite.pm.
If you have further questions that have to do with CGI scripting in
general rather than Perl-specific aspects of such, we'd all appreciate it
if you would ask them in comp.infosystems.www.authoring.cgi (after
reading the FAQs there, of course) rather than here.
------------------------------
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 1522
**************************************