[13246] in Perl-Users-Digest
Perl-Users Digest, Issue: 656 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 26 17:07:19 1999
Date: Thu, 26 Aug 1999 14:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 26 Aug 1999 Volume: 9 Number: 656
Today's topics:
Re: Accounts and CPAN module (Alan Curry)
Re: Accounts and CPAN module <gellyfish@gellyfish.com>
Amsterdam Perl Mongers Meeting (Robert Jan)
Re: Collect Information in DB or text file? <cassell@mail.cor.epa.gov>
Re: compiler for Perl? <polson2@uswest.net>
Re: compiler for Perl? <polson2@uswest.net>
Re: Date/time problems <news@news.news>
Re: Help! Syntax error that I can't find! (Eric Bohlman)
Re: Help: Perl replace special char from multiple form <simsi@hotmail.com.nospam>
Re: Implementing a Perl Script on NT (Larry Rosler)
Re: Locate a substring?! <phil@proteacher.com>
mail attachment thr' Net::SMTP ? <achaubal@admin.tavsnet.com>
Re: mail attachment thr' Net::SMTP ? <cassell@mail.cor.epa.gov>
Re: MIME::Lite newbie question <david.kernen@bms.com>
Programmers Needed www@www.com
Re: Programmers Needed (Abigail)
Regexp bug or what? <thierry.metoudi@francemel.com>
Re: Regexp bug or what? (Larry Rosler)
Re: Running Apache & Active PERL! <jeff@vpservices.com>
Split behaviour with empty fields (Fred Strauss)
Re: Split behaviour with empty fields (Abigail)
Re: Split behaviour with empty fields <cassell@mail.cor.epa.gov>
Re: The extent of double-quotish interpolation (Alan Curry)
Re: The extent of double-quotish interpolation (Randal L. Schwartz)
Re: The extent of double-quotish interpolation (Abigail)
Re: VERY VERY VERY weird things happening (Ilya Zakharevich)
Re: Visibility of inlined subs <cassell@mail.cor.epa.gov>
Re: where command is coming from <flavell@mail.cern.ch>
Re: where command is coming from <cassell@mail.cor.epa.gov>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Aug 1999 19:42:07 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Accounts and CPAN module
Message-Id: <jMgx3.26615$x04.1579876@typ11.nn.bcandid.com>
In article <slrn7sapg2.n0r.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>Lars Thegler (lars@thegler.dk) wrote on MMCLXXXVI September MCMXCIII in
><URL:news:37C55974.4F0F0DBA@thegler.dk>:
>%% The central point is that the 'make install' must be run as root. It
>%% doesn't matter what user you run the preceeding steps as. I usually run
>%% 'perl -MCPAN -e shell' as root anyway.
>
>
>And you blindly trust the entire Internet population that can put
>whatever they want there?
Here's the way it SHOULD be done: First make -n install. Then inspect its
output. Then su and run make install if it looked good, otherwise run through
the commands it gave and run them the way you want them to be.
A good Makefile will produce a simple list of install commands when you say
make -n install, like:
$ make -n install
install -m 755 -o root -g root prog /usr/bin
install -m 644 -o root -g root prog.1 /usr/man/man1
install -d -m 755 /usr/lib/prog
install -m 644 data/* /usr/lib/prog
$
Unfortunately, the art of writing good Makefiles has been mostly replaced by
the art of auto-generating crappy Makefiles.
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: 26 Aug 1999 21:12:22 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Accounts and CPAN module
Message-Id: <7q4ajm$12l$1@gellyfish.btinternet.com>
On 26 Aug 1999 10:15:34 -0500 Abigail wrote:
> Jonathan Stowe (gellyfish@gellyfish.com) wrote on MMCLXXXVI September
> MCMXCIII in <URL:news:37c5514c_2@newsread3.dircon.co.uk>:
> ;;
> ;; I have been using 'sudo' - but generally you will either want to run
> ;; the CPAN installation as root (where it will install with no problem) or
> ;; run the install as a normal user - it will generally fail when it actually
> ;; goes to install the files to where they will finally live : at this point
> ;; you will have to su root and continue the install by cd'ing to .cpan/build/
> ;; <whatever> and run 'make install' ...
>
>
> That of course assumes your Perl installation is owned by root.
>
I did say 'generally fail'.
> But there's no reason it should be owned by root. And since everyone
> can put a package in CPAN, I'm don't like blindy running 'make' or
> 'make install' as root.
>
For myself I would generally examine a makefile before using it.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Aug 1999 19:07:04 GMT
From: rj@NOT4MAIL.xs4all.nl (Robert Jan)
Subject: Amsterdam Perl Mongers Meeting
Message-Id: <slrn7sb42o.3n1.rj@wiet.xs4all.nl>
[English version follows the dutch text]
Amsterdam.pm staat voor de "Amsterdamse Perl Mongers", een groep van
gebruikers van Perl. In tegenstelling tot wat de naam suggereert is
Amsterdam.pm niet beperkt tot alleen Amsterdam, maar functioneert, tot
er meer gebruikersgroepen in Nederland zijn, als Nederlandse
gebruikersgroep.
Amsterdam.pm organiseert informele bijeenkomsten waar Perl gebruikers
kunnen samenkomen en informatie en gebruikservaringen met betrekking
tot Perl kunnen uitwisselen. Deze bijeenkomsten vinden normaliter
plaats op elke eerste dinsdag van de maand. De voertaal binnen
Amsterdam.pm is in pricipe Nederlands, maar indien nodig zal Engels
worden gebruikt, b.v. om te communiceren met niet-Nederlandssprekende
aanwezigen.
De eerstvolgende bijeenkomst vindt plaats op dinsdag 7 september 1999
van 20:00 tot 22:00 uur in het kantoorgebouw van XS4ALL Internet,
Eekholt 32, Diemen. Dit is bereikbaar met metro 53 richting Gaasperplas,
halte "Verrijn Stuartweg".
Liefhebbers van een etentje vooraf kunnen tussen 17:45 en 18:15
verzamelen in café "Maximiliaan" op de Nieuwmarkt.
Om 18:15 (écht om 18:15!) zoeken we een restaurantje in de buurt om
een hapje te eten.
Bezoek onze Web site http://www.Amsterdam.pm.org/ voor meer details.
[English version]
Amsterdam.pm stands for the Amsterdam Perl Mongers. We're basically a
Perl user group. Despite its name, it is not local to the Amsterdam
environment, but it welcomes Perl mongers from all over the
Netherlands.
Amsterdam.pm organises informal meetings where Perl users can meet,
and exchange information and experiences with regard to using Perl.
The meetings are normally held every first Tuesday of the month.
Although the preferred language for communication is Dutch, English
will be spoken if necessary.
Our next meeting is Tuesday September 7th, 1999, from 20:00 till 22:00
at the office of XS4ALL Internet, Eekholt 32, Diemen. You can reach this
place by public transport, metro 53 to Gaasperplas, stop "Verrijn Stuartweg".
Should you want to join some of us for dinner, please gather between
17:45 and 18:15 in café "Maximiliaan" located on the Nieuwmarkt.
At 18:15 sharp we'll leave for a restaurant somewhere nearby for dinner.
See http://www.Amsterdam.pm.org/ for more details.
Robert Jan
------------------------------
Date: Thu, 26 Aug 1999 13:26:49 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Collect Information in DB or text file?
Message-Id: <37C5A309.EA24BB42@mail.cor.epa.gov>
Konrad Mathieu wrote:
>
> Hi everybody!
> I need to collect E-mail adresses submitted by an html form in either a DB
> or a text file. Is this an easy task and how could I start (I'm quite a
> novice)?
You can do both pretty easily in Perl. But what are you going
to do with the results? If you'll want to do queries [look
at specified subsets of the data], then you'll probably want to
use the DBI module with one of the DBD::* modules. If you're
just accumulating info for later processing, a text file might
be adequate. Or you could do both: use a CSV [comma-separated
values] text file, and the DBD::CSV module to maipulate it.
Either way, you'll want to learn some Perl first. Check out
the web tutorial at:
http://www.netcat.co.uk/rob/perl/win32perltut.html
which, despite its name, is not win32-centric. Then get
"Learning Perl" or "Learning Perl on Win32 Systems".
BTW, the DBI docs are quite good, and there are Perl/DBI
tutorials on the web too.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 26 Aug 1999 13:42:03 -0600
From: "Patrick L. Olson" <polson2@uswest.net>
Subject: Re: compiler for Perl?
Message-Id: <mMgx3.358$7t6.29138@news.uswest.net>
perl2exe works fine once you understand what it needs. just remember
that your 2K .PL file will grow to 800K file. I am thinking of getting
this
just so I can have stand alone apps I read that the registered version
gives you the tiny command
where you use..
use win32:API
#include c:\fulladdress\win32:api,,,,,,,,<<<<<May not be proper syntax?
as the errors indicates
always
#!perl -w
use strict;
[L] Vicious! <baal@c2i.net> wrote in message
news:yKdx3.97$rb6.10864@juliett.dax.net...
> Could anyone point me in a direction where I can find a compiler for
Perl. I
> am running Win98 and I'm using Tk + Win32 modules. It only has to make
and
> EXE-file of my PL-file. I need a FREE one, not a
> half-working-demo-error-message-producing compiler. I have already
tried
> perl2exe, perlapp and djgpp, but none fit my OS or my program.
>
>
>
>
------------------------------
Date: Thu, 26 Aug 1999 13:57:33 -0600
From: "Patrick L. Olson" <polson2@uswest.net>
Subject: Re: compiler for Perl?
Message-Id: <Y_gx3.388$7t6.30679@news.uswest.net>
I was right about the proper syntax
here is my first job...
and the final is at
http://www.patricko.tzo.com/cisco_router.shtm
I elected to keep it a .pl file because of the time
to load a 800K file verses a 2K file is a big difference
Still learning though ?
#perl2exe_include SerialPort.pm
#perl2exe_include Win32.pm
#perl2exe_include API.pm
#! perl -w
use strict;
use Win32::api;
use Win32::SerialPort;
use Win32::SerialPort 0.11;
print "<br>Loading Router Information<br>\n";
my $ob = Win32::SerialPort->start ("D:/Xitami/cgi-bin/tpj4.cfg") || die;
print "<p>Cisco Systems 675 Show Int wan0:</p>\n";
$ob->read_interval(0);
$ob->read_const_time(10000);
$ob->write ("\r");
sleep 1;
my ($count, $result) = $ob->read(39);
#print "$result";
$ob->write("\r");
sleep 1;
$result = $ob->input;
$ob->write("\r");
sleep 1;
$result = $ob->input;
#print "$result";
$ob->write("show int wan0\r");
sleep 1;
($count, $result) = $ob->read(15);
print "<p>$result<BR>";
sleep 1;
($count, $result) = $ob->read(27);
print "$result<BR>";
sleep 1;
($count, $result) = $ob->read(21);
print "$result<BR>";
sleep 1;
($count, $result) = $ob->read(45);
print "$result<BR>";
sleep 1;
($count, $result) = $ob->read(27);
print "$result<BR>";
sleep 1;
($count, $result) = $ob->read(52);
print "$result<BR></p>";
sleep 1;
$ob->write("show int wan0\r");
sleep 1;
($count, $result) = $ob->read(22);
print "<p>$result<BR>";
sleep 1;
($count, $result) = $ob->read(27);
print "$result<BR>";
sleep 1;
($count, $result) = $ob->read(21);
print "$result<BR>";
sleep 1;
($count, $result) = $ob->read(45);
print "$result<BR>";
sleep 1;
($count, $result) = $ob->read(27);
print "$result<BR>";
sleep 1;
($count, $result) = $ob->read(52);
print "$result<BR></p>";
sleep 1;
$ob->write("exit\r");
sleep 1;
$result = $ob->input;
print "<p>$result</p>\n";
sleep 1;
undef $ob;
[L] Vicious! <baal@c2i.net> wrote in message
news:yKdx3.97$rb6.10864@juliett.dax.net...
> Could anyone point me in a direction where I can find a compiler for
Perl. I
> am running Win98 and I'm using Tk + Win32 modules. It only has to make
and
> EXE-file of my PL-file. I need a FREE one, not a
> half-working-demo-error-message-producing compiler. I have already
tried
> perl2exe, perlapp and djgpp, but none fit my OS or my program.
>
>
>
>
------------------------------
Date: Thu, 26 Aug 1999 21:56:15 +0100
From: news <news@news.news>
Subject: Re: Date/time problems
Message-Id: <37C5A9EF.99AA8B59@news.news>
Martien Verbruggen wrote:
> In article <37C46DAC.A4777EDA@news.news>,
> news <news@news.news> writes:
> > Dear all,
> >
> > # This prints seconds from epoch ok
> > $date = time;
> >
> > # This returns nothing
> > $date = localtime;
> >
> > This too
> > $date =gmtime;
> >
> > Any ideas? I can't use the date command becuase it is not available.
>
> Is this maybe perl 4?
>
> If so, you probably should get yourself a perl5 installation.
>
If this was Perl 4, is there an alterative to localtime and gmtime?Thanks,
Saiid.
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | The gene pool could use a little
> Commercial Dynamics Pty. Ltd. | chlorine.
> NSW, Australia |
------------------------------
Date: 26 Aug 1999 19:24:37 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Help! Syntax error that I can't find!
Message-Id: <7q449l$4an@dfw-ixnews5.ix.netcom.com>
Ron Lester (rlester@columbus.rr.com) wrote:
: I'm a Perl(5) newbie, and I've had some success writing and executing
: simple scripts. I'm writing the script for an online store right now,
: and I
: have some syntax errors with the following subroutine. No matter how
I hate to have to say this, but right now you're in over your head.
Developing the software to run an online store requires *far* more
programming knowledge than "writing and executing simple scripts." Your
code shows that you have yet to learn many of the most basic principles
of Perl syntax. There's nothing inherently wrong with that; we all have
to start somewhere. But you're trying to start at your destination,
which is impossible. You're trying to run a marathon before you've
finished learning to crawl.
If the script isn't needed yesterday, I suggest you grab a copy of
_Learning Perl_ and read it before trying any more work on your script.
If it *is* needed yesterday, I'd really suggest you subcontract it to
someone. Please remember that you're writing code that handles other
people's money in Real Life; that is *not* what I'd call a good
beginner's project.
:
: #####################################
: # getKW
: #####################################
:
: sub getKW
: {
:
: my $keywordstring = @_;
You're setting $keywordstring to the number of arguments passed to
getKW(). I really doubt that's what you want to do.
: my @products_kw;
: my @keywords;
:
: $keywordstring =~ s/[\W]/[\s];
That's not even legal syntax. A substitution needs *three* delimiters.
: @keywords = split(/[\s]/,$keywordstring);
:
: open(DATAFILE,$PRODUCT_DB) || $self->error($DB_ERROR);
:
: $i=0;
: my @db_row;
: my @products_kw_temp;
: my %product_tally;
: my $i;
:
:
: # @products_kw_temp will be filled with all items that match
: # at least one kw. if an item matches two keywords, it will
: # appear twice. the hash %product_tally will keep track of how
: # many times each product appears in @products_kw_temp. then
: # @products_kw will be filled so that the products with the most
: # appearances will be LAST so that they will appear FIRST in the
: # products array that will be generated by newstore.cgi
:
:
: while ($line=<DATAFILE>) {
: @db_row = split(/\|/,$line);
: foreach $i @keywords {
That's not the right syntax for a "for" or "foreach" statement.
: if (($db_row[4] =~ /$i/i) || ($db_row[6] =~ /$i/i)) {
Are you sure you want a pattern match here rather than an exact comparison?
: my $newproduct = new Product($db_row[0]);
: push(@products_kw_temp, $newproduct);
: }
: }
: }
:
: foreach $i @products_kw_temp {
: ++$product_tally{i};
: }
Why the extra pass? The only way an entry can get into @products_kw_temp
is through the 'push' in the previous loop, so why not update the tally
there?
:
: # a safe upper limit for the number of appearances is 20
: my $index = 20;
:
: foreach $i keys(%product_tally) {
Once again, look up the syntax for a for loop.
: if $product_tally{$i} > 20 {
: push(@products_kw,$i)
: }
: }
:
: foreach $i keys(%product_tally) {
And here.
: while $index > 0 {
And look up the syntax for a while loop.
: if $product_tally{$i} = $index {
And the syntax for an if statement. And the difference between a
comparison and an assignment.
: push(@products_kw,$i);
: --$index;
: }
: }
: }
:
: close (DATAFILE);
:
: return @products_kw;
: }
The reason I've told you to look things up rather than telling you "what
to type to fix your script" is that if you're going to have *any* chance
of successfully completing this project, you're going to absolutely
*need* exposure to the parts of the documentation in question and you're
going to have to develop an understanding of *why* those statements were
erroneous. And besides, I have no idea whether your script will do what
you want it to after those syntax errors are fixed; I don't consider it
responsible to modify code I don't understand.
Sorry if I seem to be raining on your parade, but I really do think
you've bitten off more than you can chew at this time.
------------------------------
Date: Thu, 26 Aug 1999 21:14:40 +0100
From: "Simmo" <simsi@hotmail.com.nospam>
Subject: Re: Help: Perl replace special char from multiple form field (was Select Multiple Form Field via Perl into Oracle error)
Message-Id: <jehx3.38$2B2.146@news.enterprise.net>
Thanks Makarand....i'll do that :-)
Ian
Makarand Kulkarni wrote in message <37C57E79.49B2F2F5@cisco.com>...
>[ JB wrote:
>
>This is mentioned in the CGI.pm documentation. Look for where
>the Vars() method is explained.
>
>Anyway, if you use CGI.pm then multiple params are taken care
>of automatically.
>
>--Makarand
>
------------------------------
Date: Thu, 26 Aug 1999 11:57:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Implementing a Perl Script on NT
Message-Id: <MPG.122f2de232a631a4989eb5@nntp.hpl.hp.com>
In article <7q51h7$mm1$1@news.vsnl.net.in> on Thu, 26 Aug 1999 22:46:45
+0530, Julie Tuck <iwebmaster@email.com> says...
> I have made a perl script that works perfectly well on a Unix server,, but
> now I require to Execute it on an NT server, could you please tell what
> chanes should make in the script to make it work on an NT server.
Unless you have filenames that need to be changed or calls to system(),
exec(), or qx() that execute nonportable commands, everything ought to
work.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 26 Aug 1999 13:10:03 -0700
From: "Phil Schaechter" <phil@proteacher.com>
Subject: Re: Locate a substring?!
Message-Id: <sbhx3.11$UK.233@chrome.eng.netapp.com>
Thanks, that's just what I'm looking for
Phil
Andrew Johnson wrote in message ...
>In article <7q3url$r8r$1@brokaw.wa.com>,
> Lauren Smith <laurensmith@sprynet.com> wrote:
>!
>! Phil Schaechter wrote in message ...
>! >Does anyone know how to locate a substring within a string in perl? Is
>! >there a simple function for this (something like strstr() in C?)
>!
>! Hold onto your hat on this one... *drumroll*
>
>! substr()
>!
>! *fanfare*
>
>substr() isn't much help in locating substrings ... you'll want
>to use index() or rindex() to find the offset of the first or
>last occurrence of a substring within a string.
>
>andrew
>
>--
> The generation of random numbers is too
> important to be left to chance.
>
------------------------------
Date: Thu, 26 Aug 1999 15:38:15 -0400
From: "Ameet Chaubal" <achaubal@admin.tavsnet.com>
Subject: mail attachment thr' Net::SMTP ?
Message-Id: <7q44c6$g6a$1@frontier2.tavsnet.com>
Hi all
How do I send a file as attachment to a mail message that I am sending
thr' Net::SMTP module?
Thanks
Ameet
------------------------------
Date: Thu, 26 Aug 1999 13:57:37 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: mail attachment thr' Net::SMTP ?
Message-Id: <37C5AA41.27BE524@mail.cor.epa.gov>
Ameet Chaubal wrote:
>
> Hi all
>
> How do I send a file as attachment to a mail message that I am sending
> thr' Net::SMTP module?
You asked this exact same question on comp.lang.perl.modules
and you didn't even bother to crosspost. That's poor Usenet
ettiquette.
I answered your question fully there, so I'll just say:
MIME
HAND,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 26 Aug 1999 15:27:15 -0400
From: David J Kernen <david.kernen@bms.com>
Subject: Re: MIME::Lite newbie question
Message-Id: <37C59513.86F27D5A@bms.com>
It's true that most e-mail clients display text attachments in-line. One way
around it is to not admit that the attachments are text.
Claim that they're binary or something. For example, I have a text file that
contains tab-delimited columns of data. I send it as
binary/xls and then it's not included in the body of the message. Better yet,
double clicking on it launches Excel, which then imports the file into a
spreadsheet, which is what I want. (If I wanted to launch word I might try
binary/doc as the content type.)
Hasta luego,
Dave Kernen
dan@tuatha.sidhe.org wrote:
> If you're adding the text bits to a multipart/mixed, you're doing the
> right thing. Many mail clients show all the text parts regardless of the
> message structure, though. (PINE and Eudora do sometimes, and I'd bet the
> Microsoft ones do too.
>
> Basically nothing you can do about it, alas. You're best off sticking to
> the standard and letting the mail clients misbehave. (Trying to fight them
> is doomed to failure, alas)
>
> Dan
------------------------------
Date: Thu, 26 Aug 1999 09:10:03 GMT
From: www@www.com
Subject: Programmers Needed
Message-Id: <ifgx3.113$DO2.3631@news.corecomm.net>
Looking for web designer and programmers in the Chicago area or Southwest
suburbs. If interested, please contact ybid@orbitel.com
Thanks
------------------------------
Date: 26 Aug 1999 14:34:08 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Programmers Needed
Message-Id: <slrn7sb5n4.n0r.abigail@alexandra.delanet.com>
www@www.com (www@www.com) wrote on MMCLXXXVI September MCMXCIII in
^^^^^^^
<URL:news:ifgx3.113$DO2.3631@news.corecomm.net>:
`` Looking for web designer and programmers in the Chicago area or Southwest
`` suburbs. If interested, please contact ybid@orbitel.com
^^^^^^^^^^^
www.com is located in California, orbitel.com is located in Illinios.
You claim to be interested in people in Chicago.
Hmmm.
Why should I believe you aren't trying to pull some scam?
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 24 Aug 1999 23:52:09 +0200
From: Thierry METOUDI <thierry.metoudi@francemel.com>
Subject: Regexp bug or what?
Message-Id: <37C31408.8F893EAB@francemel.com>
--------------A6F55D87100475327F90109B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
I'm using ActivePerl build 509 and I noticed that the + regexp
quantifier doesn't seem to work properly.
example:
$p = "999 yyyyyy";
if ( $p=~/(\d+?)\s*?([A-Za-z]+?)/g ) {
print "$1\t$2\n";
}
output:
999 y
and if we change the code for:
if ( $p=~/(\d+?)\s*?([A-Za-z]+)/g ) {
outputs:
999 yyyyyy
this is the desired output but the regexp should be the first one to get
this result. Right?
Thierry
--------------A6F55D87100475327F90109B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<br>I'm using ActivePerl build 509 and I noticed that the + regexp
quantifier doesn't seem to work properly.
<p>example:
<p><tt>$p = "999 yyyyyy";</tt>
<br><tt>if ( $p=~/(\d+?)\s*?([A-Za-z]<font color="#FF0000">+?</font>)/g
) {</tt>
<br><tt> print "$1\t$2\n";</tt>
<br><tt>}</tt>
<p><tt>output:</tt>
<br><tt>999 y</tt>
<p>and if we change the code for:
<p><tt>if ( $p=~/(\d+?)\s*?([A-Za-z]<font color="#FF0000">+</font>)/g )
{</tt><tt></tt>
<p><tt>outputs:</tt>
<br><tt>999 yyyyyy</tt><tt></tt>
<p><tt>this is the desired output but the regexp should be the first one
to get this result. Right?</tt><tt></tt>
<p><tt>Thierry</tt></html>
--------------A6F55D87100475327F90109B--
------------------------------
Date: Thu, 26 Aug 1999 12:55:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regexp bug or what?
Message-Id: <MPG.122f3b834e1faae9989eb6@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <37C31408.8F893EAB@francemel.com> on Tue, 24 Aug 1999
23:52:09 +0200, Thierry METOUDI <thierry.metoudi@francemel.com> says...
> I'm using ActivePerl build 509 and I noticed that the + regexp
> quantifier doesn't seem to work properly.
Don't bet on that!
> example:
>
> $p = "999 yyyyyy";
> if ( $p=~/(\d+?)\s*?([A-Za-z]+?)/g ) {
> print "$1\t$2\n";
> }
>
> output:
> 999 y
You told it to match a string of at least one letter, but as few as
possible, so it did.
> and if we change the code for:
>
> if ( $p=~/(\d+?)\s*?([A-Za-z]+)/g ) {
>
> outputs:
> 999 yyyyyy
>
> this is the desired output but the regexp should be the first one to get
> this result. Right?
Wrong.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 26 Aug 1999 20:04:29 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Running Apache & Active PERL!
Message-Id: <37C59CD8.1D1568B7@vpservices.com>
Paul Wood wrote:
>
> I found it pretty much impossible to get Apache to run correctly under
> Win95. My final (imperfect) solution was with MS Personal Web Server.
Hmm, you don't really give us much info on what "impossible" means but I
have never had any problems using apache/win95/activePerl (tho I haven't
gotten mod_perl working in that setup yet). Other alternatives include
omni and xitami httpd servers.
--
Jeff
------------------------------
Date: Thu, 26 Aug 1999 19:32:16 GMT
From: fred_strauss@ap.org (Fred Strauss)
Subject: Split behaviour with empty fields
Message-Id: <37c594c2.170737361@news.supernews.com>
I'm having a strange "problem" using split().
If I do the following:
@tokens = split /;/, "PLAYER;1;Janzen;Lee;;;1;;;;;;0;3;;;;;;;;;;";
I get back 14 elements in @tokens.
If I do:
@tokens = split /;/, "PLAYER;1;Janzen;Lee;;;1;;;;;;0;3;;;;;;;;;;0";
I get back 24 which is what I expected in the first.
It's obvious that this is intended behaviour, I'm just wondering why?
Thanks,
Fred
------------------------------
Date: 26 Aug 1999 14:37:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Split behaviour with empty fields
Message-Id: <slrn7sb5u7.n0r.abigail@alexandra.delanet.com>
Fred Strauss (fred_strauss@ap.org) wrote on MMCLXXXVI September MCMXCIII
in <URL:news:37c594c2.170737361@news.supernews.com>:
__
__ If I do the following:
__ @tokens = split /;/, "PLAYER;1;Janzen;Lee;;;1;;;;;;0;3;;;;;;;;;;";
__ I get back 14 elements in @tokens.
__
__ If I do:
__ @tokens = split /;/, "PLAYER;1;Janzen;Lee;;;1;;;;;;0;3;;;;;;;;;;0";
__ I get back 24 which is what I expected in the first.
__
__ It's obvious that this is intended behaviour, I'm just wondering why?
Because it was decided that that would be more useful.
Did you read the man page about split? This features is of course
documented, and so is the option to turn off this feature.
Abigail
--
sub J::FETCH{Just }$_.='print+"@{[map';sub J::TIESCALAR{bless\my$J,J}
sub A::FETCH{Another}$_.='{tie my($x),$';sub A::TIESCALAR{bless\my$A,A}
sub P::FETCH{Perl }$_.='_;$x}qw/J A P';sub P::TIESCALAR{bless\my$P,P}
sub H::FETCH{Hacker }$_.=' H/]}\n"';eval;sub H::TIESCALAR{bless\my$H,H}
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 26 Aug 1999 14:03:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Split behaviour with empty fields
Message-Id: <37C5ABBB.6D18EA0C@mail.cor.epa.gov>
Fred Strauss wrote:
>
> I'm having a strange "problem" using split().
>
> If I do the following:
>
> @tokens = split /;/, "PLAYER;1;Janzen;Lee;;;1;;;;;;0;3;;;;;;;;;;";
>
> I get back 14 elements in @tokens.
>
> If I do:
>
> @tokens = split /;/, "PLAYER;1;Janzen;Lee;;;1;;;;;;0;3;;;;;;;;;;0";
>
> I get back 24 which is what I expected in the first.
>
> It's obvious that this is intended behaviour, I'm just wondering why?
Interestingly enough, your question is answered in the first
two lines of the documentation on split() . You can read
the entire perlfunc manpage by typing at a command prompt:
perldoc perlfunc
or if you just wanted to read the piece on split() only:
perldoc -f split
The reason why is simple. Perl tries to DWIM [Do What I Mean].
If I have a long string of ';' stuck on the ends of some lines,
I don't want Perl to add a bunch of empty elements at the
end of my array. I'd just have to walk through the array
and get rid of them. OTOH, Perl will let you keep the extras
if you want. All you have to do is tell it to.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 26 Aug 1999 19:07:35 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: The extent of double-quotish interpolation
Message-Id: <Xfgx3.26571$x04.1576558@typ11.nn.bcandid.com>
In article <m1k8qi78pe.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Lauren" == Lauren Smith <laurensmith@sprynet.com> writes:
>
>Lauren> I'm somewhat surprised that "$f->()" does not make the call to the sub,
>Lauren> but "$a[$f->()]" does.
>
>This is simple, when you remember the very simple rule:
>
> Perl doesn't interpolate expressions, just variables.
>
>$f->() is an expression. $a[...] is a variable, and you have to
>compute the ... to figure out which one.
>I don't know why people are so surprised. Maybe they never learned
>the basic rule. :)
>
>Part of the confusion is that:
>
> $f->{$w} is a variable (same as $$f{$w}, treat $f as a hashref)
Ouch! I have trouble remembering the precedence of things like $$f{$w}, so I
always use the form with the arrow. If I saw $$f{$w} without explanation, I
wouldn't know if it was ${$f}{$w} or ${$f{$w}}. Yes, you can tell me the
rule, or I can look it up, just like I can look up the rule that says &&
binds tighter than ||. But I'm still looking up the precedence of && and ||
after 6 years.
> $f->[$x] is a variable (same as $$f[$x], treat $f as a arrayref)
> $f->foo($y) is an expression (invoke method foo on object $f)
> $f->($z) is an expression (same as &$f($z), treat $f as a coderef)
Since &$f($z) doesn't start with $ or @, it doesn't interpolate. That's
simple enough. But I don't see what relevance that has when I didn't write it
that way anyhow.
>so the similarities are probably enough to lead people to think that
>Perl interpolates all "->". Nope. :)
I think I have a procedure worked out now.
0. The interpolation start point is always a $ or @.
1. If there is an identifier after it, move ahead to the end of it.
2. If the next character is a [, {, ->[, or ->{, move ahead to the matching ]
or }.
3. Repeat step 2 until you are not at a [, {, ->[, or ->{.
4. You are now at the interpolation end point.
5. The substring you've just identified is evaluated as an expression,
meaning that in the subscripts, anything goes.
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: 26 Aug 1999 12:09:47 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: The extent of double-quotish interpolation
Message-Id: <m1u2pm4av8.fsf@halfdome.holdit.com>
>>>>> "Abigail" == Abigail <abigail@delanet.com> writes:
Abigail> .. This is simple, when you remember the very simple rule:
Abigail> ..
Abigail> .. Perl doesn't interpolate expressions, just variables.
Abigail> Really? Tell me, which variable is interpolated in:
Abigail> "${\+3}"
The variable that comes from dereferencing the reference taken to +3.
Sure, it's read-only, but it's still syntactically a variable.
Witness:
$ perl -ce '${\+3} = 17'
-e syntax OK
So when I say "variable", I mean, things that can go on the left side
of an assignment operator. With the additional criterion that it
cannot have imbedded whitespace if it's being interpolated.
And notwithstanding the new lvalue subs. :) :)
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 26 Aug 1999 14:26:48 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: The extent of double-quotish interpolation
Message-Id: <slrn7sb59c.n0r.abigail@alexandra.delanet.com>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMCLXXXVI September
MCMXCIII in <URL:news:m1u2pm4av8.fsf@halfdome.holdit.com>:
&& >>>>> "Abigail" == Abigail <abigail@delanet.com> writes:
&&
&& Abigail> .. This is simple, when you remember the very simple rule:
&& Abigail> ..
&& Abigail> .. Perl doesn't interpolate expressions, just variables.
&&
&&
&& Abigail> Really? Tell me, which variable is interpolated in:
&&
&& Abigail> "${\+3}"
&&
&& The variable that comes from dereferencing the reference taken to +3.
&& Sure, it's read-only, but it's still syntactically a variable.
&&
&& Witness:
&&
&& $ perl -ce '${\+3} = 17'
&& -e syntax OK
$ perl -we '${\+3} = 17'
Modification of a read-only value attempted at -e line 1.
That suggests that Perl thinks it's a value, not a variable. man perldiag
says this error occurs when you try to modify a constant; which is quite
the opposite of a variable.
&& So when I say "variable", I mean, things that can go on the left side
&& of an assignment operator. With the additional criterion that it
&& cannot have imbedded whitespace if it's being interpolated.
You mean typeglobs, substr and %hashes? ;-)
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 26 Aug 1999 20:53:48 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: VERY VERY VERY weird things happening
Message-Id: <7q49gs$lvu$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Slav Inger
<vinger@mail.ford.com>],
who wrote in article <37C54E0B.392BA6F0@mail.ford.com>:
> > > %hash = (
> > > h1 => {}
> > > );
> >
> > This creates hash of hashes.
> The idea was to have more than one value per key in the $hash{h1},
> essentially having an array correspond to each key. Is there a way to
> pre-declare a hash inside of a hash, the inner (in this case h1) one
> being a hash of arrays? In the above snippet, I pre-declared a hash of
> hashes.
No, you did not. No more than
$foo = "bar";
predeclares $foo as having "bar" as contents. There are no such
predeclarations in Perl. You *created* hash of hashes.
Ilya
------------------------------
Date: Thu, 26 Aug 1999 13:32:00 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Visibility of inlined subs
Message-Id: <37C5A440.96B43C80@mail.cor.epa.gov>
Paul Wood wrote:
>
> Some inlined subroutines are being included from a library file (into the
> main package), but they don't appear to be working correctly from outside of
> that file. Functions in that same file can use them fine, but anything else
> (even if I explicitly add the package name) uses the constant names as
> strings. If redefine them in each file, I still get the "Constant subroutne
> redefined" warning. Any ideas?
Yes. You ought to look in the perldiag pages whenever you get an
error you don't understand. Here's what this says:
Constant subroutine %s redefined
(S) You redefined a subroutine which had previously been eligible
for inlining. See perlsub for commentary and workarounds.
So go to the perlsub pages [read them in HTML or using the command
'perldoc perlsub'] and read, as indicated.
You're doing something wrong, but I can't tell exactly what from
here. I tried using the PSI::ESP module, but all I got was a
vague indication about problems with exporting properly.
If you still can't get your program working, cut the source down
to less than 40 lines which illustrate your problem, and re-post.
We might be able to help you then.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 26 Aug 1999 21:53:46 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: where command is coming from
Message-Id: <Pine.HPP.3.95a.990826215142.14535B-100000@hpplus03.cern.ch>
On Thu, 26 Aug 1999, Phil Schaechter blurted out:
> Let's attempt to be a little more polite, mmmkay?
Right, that's it. You stride in here without the vestige of a clue,
posting in clueless newbie style, hand out a couple of bogus answers,
and now you've decided to play etiquette police. *plonk*
------------------------------
Date: Thu, 26 Aug 1999 13:49:57 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: where command is coming from
Message-Id: <37C5A875.414025B1@mail.cor.epa.gov>
Phil Schaechter wrote:
>
> Let's attempt to be a little more polite, mmmkay?
Thank you for for consideration. Since you feel it is okay to
speak for others, may I do so as well?
Please check your answers for correctness before posting.
Please use the standard Usenet style [answer *after* quoted
material] for replies.
Please trim unneeded material from posts, particularly sigs.
Please evaluate responses based on the history of the
thread, subject matter, and people involved - if you know
none of the three, then use deja.com to check first.
In this newsgroup there is a deliberate "Have you done your
homework, young man?" approach, due to the large number
of inappropriate and incomplete posts. Furthermore, Perl
has answers for many of these already in the FAQ which
accompanies every proper install. The people who spent
hundreds if not thousands of person-hours writing and
editing and updating this FAQ quite naturally feel less
than charitable when it is obvious that posters did not
bother to look in the FAQ or to post to the correct
newsgroup.
Thank you,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 V9 Issue 656
*************************************