[16868] in Perl-Users-Digest
Perl-Users Digest, Issue: 4280 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 11 00:06:15 2000
Date: Sun, 10 Sep 2000 21: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)
Message-Id: <968645111-v9-i4280@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 10 Sep 2000 Volume: 9 Number: 4280
Today's topics:
0e0 ... behaves different ?? <bitman2@my-deja.com>
Re: [Q] $_ assignmt in map: bug? <elephant@squirrelgroup.com>
Re: Can PERL detect a web-browser's PORT??? (Gwyn Judd)
Re: Count of items is EXCEPTION not RULE (was Re: Littl <tina@streetmail.com>
Re: Count of items is EXCEPTION not RULE (was Re: Littl <ren.maddox@tivoli.com>
Re: Count of items is EXCEPTION not RULE (was Re: Littl (brian d foy)
Re: Entering data from an HTML into a hash of hashes <flavell@mail.cern.ch>
File I/O to access file on same server, different accou <hbarnett@net1.net>
Re: Help with number formatting needed... <jeffjohnson@earthlink.net>
Re: How long does flock take? (Ilya Zakharevich)
Re: how to extract data from html table document ? <elephant@squirrelgroup.com>
list all files in a directory? <vrillusions@mail.com>
Re: list all files in a directory? <tony_curtis32@yahoo.com>
perlguts - SV* type for exported constants (fwd) <sjohns17@uic.edu>
Re: Question about Perl <alex.turner@enformatica.com>
Re: Question about Perl <nightchills26@my-deja.com>
Re: Regular Expressions <anmcguire@ce.mediaone.net>
Re: Regular Expressions <anmcguire@ce.mediaone.net>
timeout <ryruns@aol.com>
Re: timeout (Gwyn Judd)
Re: using "|" as plain text in scripts (perl win) <elephant@squirrelgroup.com>
Re: What does "magic" mean? <dan@tuatha.sidhe.org>
Re: Where can I find information of perl internationali <elephant@squirrelgroup.com>
Re: Where to download binary DBI and DBD::mysql for win <alian@alianwebserver.com>
Re: Where to download binary DBI and DBD::mysql for win (Ian Vincent)
Re: Where to download binary DBI and DBD::mysql for win <christopher_j@uswest.net>
Re: why does foreach iterate on an undef variable? (Ilya Zakharevich)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 11 Sep 2000 02:46:28 GMT
From: Bit-Man <bitman2@my-deja.com>
Subject: 0e0 ... behaves different ??
Message-Id: <8phh20$vdb$1@nnrp1.deja.com>
Hi there,
I'm developing aMail (http://sourceforge.net/project/amail) and using
Net::POP3 (from libnet) for e-mail retrieving via POP3.
I'm developing on OpenBSD and testing on OpenBSD/Windows NT.
The problem comes with the value returned by Net::POP3->login.
From http://search.cpan.org/doc/GBARR/libnet-1.0703/Net/POP3.pm:
------------------------------------------------------------------
login ( [ USER [, PASS ]] )
Send both the the USER and PASS commands. If PASS is not given the
Net::POP3 uses Net::Netrc to lookup the password using the host and
username. If the username is not specified then the current user name
will be used.
Returns the number of messages in the mailbox. However if there are no
messages on the server the string "0E0" will be returned. This is will
give a true value in a boolean context, but zero in a numeric context.
If there was an error authenticating the user then undef will be
returned.
------------------------------------------------------------------
But, if you run a script in both machines (OpenBSD and Windows NT)
login to the same POP 3 server, it returns 0E0 in the former and 0 in
the latter.
Anyone with the same problem ??
Any clues ??
--
Victor A. Rodriguez (http://www.bit-man.com.ar)
El bit Fantasma (Bit-Man)
--
--
Victor A. Rodriguez (http://www.bit-man.com.ar)
El bit Fantasma (Bit-Man)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 11 Sep 2000 13:51:30 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: [Q] $_ assignmt in map: bug?
Message-Id: <MPG.1426e5aaeaa2940e98976d@localhost>
R. S. K. <NOrJUNKsEMAILk@nojunkemail.net> wrote ..
>I would like to know if this is a known interpreter bug, a misunder-
>standing on my part, or what. I have found this effect in versions
>5.005_02 and 5.005_04 on Linux and on NT (activeware), with the same
>behavior throughout. If it WAS a bug and was fixed in a later version,
>I'd like to know this to. I'm not even sure it's a bug; I think it
>may even be an ambiguity in the syntax grammar that wasn't anticipated.
>And it's also completely likely that I don't understand something and
>am writing nonsense.
>
>The effect: One is looping through an array and using one of the
>assignment operators to modify each member:
>
> @b = (5, 6, 7);
> @a = map $_ += 2, @b; # syntax error
> @a = map $_ *= 2, @b; # works as expected
> @a = map $_ %= 2, @b; # works as expected
> @a = map $_ /= 2, @b; # error: search pattern not terminated
> @a = map {$_ /= 2} @b; # works as expected
all work fine in 5.6
>Thanks in advance for comments by e-mail (see notice below).
and that's why you should read ALL of the post before starting a
reply/test/etc. .. oh well
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Mon, 11 Sep 2000 01:05:07 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Can PERL detect a web-browser's PORT???
Message-Id: <slrn8roc4r.586.tjla@thislove.dyndns.org>
I was shocked! How could genio1980@my-deja.com <genio1980@my-deja.com>
say such a terrible thing:
>A client/server program running, and to stop abusive users from using
>the program, We ban their IP address, however, with the use of proxies,
>this method becomes pointless... so, is there anyway to detect the port
>they are using (80, 8080, etc) so we can tell if they are using a proxy
> or not to ban them?
No. The proxy will connect to your regular webserver port (80) so there
is no way to tell. This question is off-topic for this newsgroup
however, the answer is the same whatever language you wrote your program
in.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I like work; it fascinates me; I can sit and look at it for hours.
------------------------------
Date: 10 Sep 2000 22:33:46 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Count of items is EXCEPTION not RULE (was Re: Little perl annoyance #371: glob)
Message-Id: <8ph28a$csnku$12@ID-24002.news.cis.dfn.de>
hi,
In comp.lang.perl.misc brian d foy <brian@smithrenaud.com> wrote:
> In article <8pgur9$csnku$10@ID-24002.news.cis.dfn.de>, news@tinita.de posted:
>> so that meant *if* the function returns *always* an array (or better,
>> as randal said, a list), *then*
> see Nat's post on the difference between arrays and lists.
yep.
>> $result = func();
>> will *always* give you the size.
>> your function does not always return a list, so there
>> is no contradiction.
> what the function returns depends on context. a function
> gets data through a list and returns data through a list
> (perhaps one item).
>> or more logical, I said:
>> (sub returns always list) =>
>> (call in scalar context will give you the size)
> persisting in this sort of explanation will only cause confusion.
> try this code:
> sub foo { return ( 1, 2, 4 ) }
> my $value = foo();
> print $value;
> now, try to explain that result in terms of what you just said.
nice effect, just read about this in perldata.
change that sub to
sub foo {@a=(1,2,4); @a}
that is what i meant.
so what about
"if the sub returns a copy of an array"?
if you return an array like "return @array" (yes,
which creates a copy and returns the list and
not the actual array, to make this clear again)
then my statement would make sense, wouldn't it?
in your sub the value is assigned like
$result = (1, 2, 4);
in my sub:
$result = @a;
so i shouldn't have said list instead of array;
i meant the list which is created as the
copy of the array.
phooey, i admit i was a little
surprised by your example...
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: 10 Sep 2000 15:38:07 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Count of items is EXCEPTION not RULE (was Re: Little perl annoyance #371: glob)
Message-Id: <m3ya10c79s.fsf@dhcp11-177.support.tivoli.com>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
> >>>>> "Tina" == Tina Mueller <tina@streetmail.com> writes:
>
> Tina> if there is an array returned from a function,
>
> See, it's sloppy talk like that that gets us all in trouble.
> You cannot return an array from a function. The action of:
>
> return @foo;
>
> returns a list-copy of @foo if wantarray is true, or the number of
> elements of @foo if wantarray is false. You *cannot* return an array,
> only a list or a scalar.
>
> Maybe this is why the newbies get confused. We have sloppy talk, and
> then that gets quoted as real, and then the bad book authors start
> using that, and then the newbies get very confused.
Of course, the fact that it is "wantarray" instead of "wantlist"
doesn't help.... (Or perhaps "getcontext" with some additional
functionality.)
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Sun, 10 Sep 2000 19:54:32 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Count of items is EXCEPTION not RULE (was Re: Little perl annoyance #371: glob)
Message-Id: <brian-ya02408000R1009001954320001@news.panix.com>
In article <8ph28a$csnku$12@ID-24002.news.cis.dfn.de>, news@tinita.de posted:
> if you return an array like "return @array" (yes,
> which creates a copy and returns the list and
> not the actual array, to make this clear again)
> then my statement would make sense, wouldn't it?
the trick is not to make any rules about what lists
and scalars will do in other contexts. since there
are so many functions that do very different things
in scalar and list context, it's better to not try to
intuit behaviour of other functions. look at the
documentation to see what the function is supposed
to do. indeed, if functions should be little black boxes,
then the user shouldn't be expected to look at the source
to see if it has
return ( ... );
or
return @array;
the code might do something different in the next version,
even.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Mon, 11 Sep 2000 00:44:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Entering data from an HTML into a hash of hashes
Message-Id: <Pine.GHP.4.21.0009110039230.24095-100000@hpplus03.cern.ch>
On 10 Sep 2000, Tina Mueller wrote:
> > It's only with radio buttons that having, or not having, the same name
> > is of any importance to the _client_ behaviour.
>
> right.
> and in the end, be aware that the parameters passed
> to the script don't reflect anything like checkboxes
> or textareas, but only parameters which
> can have one or more values.
You make a good point, because in the final analysis, a malicious
user can submit just any stuff that amuses them.
Certainly scripts need to be written (even by those whose name happens
to be Matt) in such a way that they will not be harmed by such stuff.
But that doesn't necessarily mean the scripts have to do anything
useful under that kind of assault.
all the best
------------------------------
Date: Sun, 10 Sep 2000 19:26:26 -0500
From: Hal Barnett <hbarnett@net1.net>
Subject: File I/O to access file on same server, different account?
Message-Id: <39BC26B2.6F550600@net1.net>
This might be a real dumb question, but...
Is there a way to read and write to text files that are on a different
account on the same server? In other words if 2 different web sites want
to share their flat files, is it possible to do this using Perl's file
I/O. I'm guessing that it would be possible if the people running the
server were to set the permissions to allow this. Is this ever done?
Thanks a lot for any help.
Hal
------------------------------
Date: Mon, 11 Sep 2000 01:57:29 GMT
From: "Jeff Johnson" <jeffjohnson@earthlink.net>
Subject: Re: Help with number formatting needed...
Message-Id: <d_Wu5.1865$QQ2.101958@newsread1.prod.itd.earthlink.net>
Thanks sooooooo much for the tip about how to use sprintf.
All is right with the world again. :)
--
Jeff Johnson
Email: jeffjohnson@earthlink.net
Internet: http://home.earthlink.net/~jeffjohnson
Randy <randy_734@my-deja.com> wrote in message
news:39bbe0d0.14628437@207.126.101.100...
> Jeff,
>
> Like everything in Perl, there's a million ways to do it. You might
> try this:
>
> change:
> $Total=($SubTotal + $Shipping);
> to:
> $Total = sprintf ("%.2f", $Shipping + $SubTotal) ;
>
> The "%.2f" is the format string. Each field begins with a %. The .2
> means 2 decimal places and the f means a fixed point number.
>
> HTH
> Randy Harris
>
> "Jeff Johnson" <jeffjohnson@earthlink.net> wrote:
>
> >Thanks for the tip but I must ask for specifics. Since I don't know much
> >about PERL I don't understand how to use the "sprintf" function you
> >suggested and the "perldoc -f sprintf" display gives no actual examples.
> >Could you please supply an example of how to use this function to format
> >numbers for screen output? Below is a sample of code that I am working
with:
> >
> > $Price=9.95;
> > $Ordered=1;
> > $Shipping=5.95;
> > $Shipvia='United States Post Office 2 to 3 Day Air'
> > $SubTotal=($Ordered * $Price);
> > $Total=($SubTotal + $Shipping);
> >
> > print "Your order for $Ordered CD(s) at \$$Price per CD comes to ";
> > print "\$$SubTotal plus \$$Shipping shipping and handling via $Shipvia
";
> > print "for a total of \$$Total.\n";
> >
> >In this example the $Total variable is diplayed as 15.9 instead of
15.90.
> >How do I format it properly? It seems that "formline" could help but I
can't
> >seem to use it properly either. The docs on PERL assume too much. They
seem
> >to explain the limits of a function but give no actual examples of how to
> >use it.
> >
> >Thanks for any suggestions,
> >Jeff Johnson
> >
> >
> >Clinton Pierce <clintp@geeksalad.org> wrote in message
> >news:lqxu5.36173$QW4.445001@news1.rdc1.mi.home.com...
> >> [Posted and mailed]
> >>
> >> In article <ajxu5.32753$K4.1388147@newsread1.prod.itd.earthlink.net>,
> >> "Jeff Johnson" <jeffjohnson@earthlink.net> writes:
> >> > I have managed to re-write the basic formmail.pl, found on many sites
> >and at
> >> > Matt's Script Archive, to include a "confirmation page" that shows
users
> >the
> >> > data they have input on a form, totals their order, and asks them to
> >> > finalize the order by selecting a "Purchase" button. Since I know a
bit
> >> > about database but nothing about PERL it took me a while to write. I
am
> >left
> >> > with two final problems to solve.
> >>
> >> Ouch. You're scaring me. You did all that, and you missed these? :)
> >>
> >> > 1.) How do I format numbers to always appear with two figures after
the
> >> > decimal point?
> >> > Example: 15.90 appears as 15.9
> >>
> >> perldoc -f sprintf
> >>
> >> > 2.) How do I "clear" memory arrays and variables before exiting a
PERL
> >> > script?
> >> > Example: Once my script "prints" parts of an array
to
> >HTML
> >> > I want to
> >> > then "clear" that array to be used again later.
> >>
> >> In 1 word: unnecessary. If you exit the script, the memory is freed.
> >> If you don't exit the script, then just let the variables fall out of
> >scope or
> >> initialize them to an empty value (like @a=();).
> >>
> >> --
> >> Clinton A. Pierce Teach Yourself Perl in 24 Hours!
> >> clintp@geeksalad.org for details see http://www.geeksalad.org
> >> "If you rush a Miracle Man,
> >> you get rotten Miracles." --Miracle Max, The Princess Bride
> >>
> >
> >
>
------------------------------
Date: 11 Sep 2000 04:04:40 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How long does flock take?
Message-Id: <8phlko$sqn$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Chris Fedde
<cfedde@u.i.sl3d.com>],
who wrote in article <juau5.21$W3.170898944@news.frii.net>:
> >> why not use Time::HiRes to put a *real* timestamp in there .. it's
> >> standard in 5.6 - not sure about earlier perls so you might need to get
> >> it from CPAN .. goes down to microseconds
> >... which most probably mean nothing. I would guess that on most
> >systems the *granularity* of HiRes is of order of 10ms... There are
> >some exceptions, of course...
> I think that your guess is off by around 3 orders of magnatude.
> At least on common pentium boxen.
I do not see what the processor has to do with this - unless you use
something like Linux, which (wrongly) use CPU cycle count for time
measurements. But it looks like on Solaris Ultra5 the results are
quite similar to what you reported:
#!/usr/bin/perl -w
#
use strict;
use Time::HiRes 'time';
my $then = time;
my $now;
my $delta;
my @tot = ( 0 ) x 100;
$#tot = -1;
for (0..100){
$now = time;
$delta = $now - $then;
$then = $now;
push @tot, $delta;
}
print for @tot;
gives something like this:
1.40666961669922e-05
1.29938125610352e-05
1.39474868774414e-05
1.40666961669922e-05
1.29938125610352e-05
1.39474868774414e-05
1.40666961669922e-05
1.39474868774414e-05
1.29938125610352e-05
1.40666961669922e-05
1.39474868774414e-05
1.40666961669922e-05
1.39474868774414e-05
1.39474868774414e-05
1.40666961669922e-05
Apparently, a lot of things improved recently...
Ilya
------------------------------
Date: Mon, 11 Sep 2000 14:15:34 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: how to extract data from html table document ?
Message-Id: <MPG.1426eb506ef12fae98976f@localhost>
Tom <tk28@gmx.net> wrote ..
>is there an facility to extract data from an html ( table ) document
>using perl on win32 ?
I don't know what "an html ( table ) document" is .. but on the off
chance that you mean - "a table within an HTML document" then have a
look at one of the many standard HTML parsing and tokenising modules
included with Perl
if you're on Win32 and using the ActiveState port of Perl then you will
find them referenced in the HTML documentation that was installed when
you installed Perl .. it's in your Start menu
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Mon, 11 Sep 2000 02:15:07 GMT
From: Todd Eddy <vrillusions@mail.com>
Subject: list all files in a directory?
Message-Id: <39BC402A.4EEB47F5@mail.com>
I want to make an archive script for this cgi I am working on. I want
it to list all the data files in a directory, then create a list. the
person then clicks on a certain file to go to that one. What I am
trying to figure out is how to scan the directory and put the list of
files in an array. Any ideas?
--
Todd Eddy
vrillusions@mail.com
http://www.vrillusions.com/
------------------------------
Date: 10 Sep 2000 21:33:17 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: list all files in a directory?
Message-Id: <87zolf1wuq.fsf@limey.hpcc.uh.edu>
>> On Mon, 11 Sep 2000 02:15:07 GMT,
>> Todd Eddy <vrillusions@mail.com> said:
> I want to make an archive script for this cgi I am
> working on. I want it to list all the data files in a
> directory, then create a list. the person then clicks
> on a certain file to go to that one. What I am trying
> to figure out is how to scan the directory and put the
> list of files in an array.
perldoc -f opendir
perldoc -f readdir
perldoc -f closedir
perldoc -f grep
hth
t
--
WWNKD?
------------------------------
Date: Sun, 10 Sep 2000 19:27:45 -0500
From: Seth David Johnson <sjohns17@uic.edu>
Subject: perlguts - SV* type for exported constants (fwd)
Message-Id: <Pine.A41.4.10.10009101927140.68408-100000@tigger.cc.uic.edu>
In dealing with a constant (in this case, one exported by Fcntl.pm) passed to
an XSUB, I noticed that the corresponding SV* passed to SvIOK() returns 0, while
the same SV* passed to SvNOK() returns 1.
Is it to be assumed that *all* exported constants are floating-point SVs, or is
it generally a good idea to check with SvIOK/SvNOK when a "header constant" is
expected to be passed to an XSUB?
Thanks in advance,
--
Seth Johnson
http://www.pdamusic.com/
------------------------------
Date: Mon, 11 Sep 2000 00:18:35 +0100
From: Alex Turner <alex.turner@enformatica.com>
Subject: Re: Question about Perl
Message-Id: <39BC16CB.4129F98@enformatica.com>
If what you want to do is really simple, then just dream up some challenge
response protocol using either sockets (the script and java are on
different machines) or the Process object in Java.
E.G..
Java says: SEARCH_FOR "romans"\n
Perl says: START_LIST\n
1\n
2\n
5\n
6\n
24\n
END LIST\n
Where the numbers were pages.
If you think you are going to make things get much more comples (and if
your project is a success then you will - that is the nature of things)
make them talk via XML.
AJ
Night Chills wrote:
> Hi All!
> I am developing an application in Java that will interact with a Perl
> script sitting on a remote webserver to retrieve information sitting in
> a text file on the webserver. My application will be client side. And
> it DOES NOT use the browser. My question is this:
>
> How do I pass my request to the perl script? Let's say that my
> application enabled the user to look up any chapter in the Bible. The
> user could search by book or by keyword. Now, let's say that he chose
> to search by book and his search string was simply "Romans". What
> information do I need to pass to the server from my application in
> order to get that one word to my perl script and what kind of parsing
> will the script have to do?
>
> Thanks in Advance,
> Anthony
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Mon, 11 Sep 2000 02:50:51 GMT
From: Night Chills <nightchills26@my-deja.com>
Subject: Re: Question about Perl
Message-Id: <8phha5$vn9$1@nnrp1.deja.com>
Okay, so let me make sure I understand this. On the server side I will
need to create a Perl program that will listen on a specified port,
right? Problem is that I am not allowed to create server processes on
my provider. So I am forced to access the script through port 80 (the
standard HTTP). So let's say that I create a connection (using a
socket) to port 80 of my webserver. I would assume it is then as simple
as requesting the script right then passing my stuff to it? If so,
then is it true that as long as I remain connected to the webserver the
Perl program will remain active? Because as I understand it a browser
does a singe request type thing. It sends the URL request then
receieves the response from the script. Then disconnects. This would
tell me that I can only pass one line of text to the program or am I
thinking in a too browser-centric way? Yep, this is convoluted but I
guess I don't really even know what question I am asking. So.....can
you offer any advice?
Anthony
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 10 Sep 2000 18:09:12 -0500
From: "Andrew N. McGuire" <anmcguire@ce.mediaone.net>
Subject: Re: Regular Expressions
Message-Id: <39BC1498.2A7F3E60@ce.mediaone.net>
On Sun, 10 Sep 2000, Mark McCarthy quoth:
MM>
MM> "Abigail" <abigail@foad.org> wrote in message
MM> news:slrn8rj2cf.b1k.abigail@alexandra.foad.org...
MM> > Dietmar Staab (dietmar.staab@t-online.de) wrote on MMDLXVI
September
MM> > MCMXCIII in <URL:news:8pbv2v$4c7$17$1@news.t-online.com>:
MM> > () In article <MPG.142307bef60e9aa298ad4b@nntp.hpl.hp.com>, Larry
Rosler
MM> > () <lr@hpl.hp.com> wrote:
MM> > ()
MM> > () > /([<"'])(.*?)\1/ and print $2;
MM> > ()
MM> > () Doesn't work, because left and right delimiter are not equal
for <>
MM> > ()
MM> > () /(["'<])(.*?)[\1>]/ and print $2;
MM> > ()
MM> > () should fix it.
MM> >
MM> >
MM> > Not really.
MM>
MM>
MM> In which case, could we instead of the
MM>
MM> [\1>]
MM>
MM> do
MM>
MM> \1|>$ (can get rid of the non-greediness then too)
That fails as \1 will still match '<' before '>' gets a chance to match.
MM> Also, if we are allowing <> possibilities, do not we also need to
worry
MM> about [],{},() too.
Perhaps.
anm
--
BEGIN { $\ = $/; $$_ = $_ for qw~ just another perl hacker ~ }
my $J = sub { return \$just }; my $A = sub { return \$another };
my $P = sub { return \$perl }; my $H = sub { return \$hacker };
print map ucfirst() . " " => ${&$J()}, ${&$A()}, ${&$P()}, ${&$H()};
------------------------------
Date: Sun, 10 Sep 2000 18:13:52 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Regular Expressions
Message-Id: <Pine.LNX.4.21.0009101810270.11175-100000@hawk.ce.mediaone.net>
On Sun, 10 Sep 2000, Mark McCarthy quoth:
MM>
MM> "Abigail" <abigail@foad.org> wrote in message
MM> news:slrn8rj2cf.b1k.abigail@alexandra.foad.org...
MM> > Dietmar Staab (dietmar.staab@t-online.de) wrote on MMDLXVI September
MM> > MCMXCIII in <URL:news:8pbv2v$4c7$17$1@news.t-online.com>:
MM> > () In article <MPG.142307bef60e9aa298ad4b@nntp.hpl.hp.com>, Larry Rosler
MM> > () <lr@hpl.hp.com> wrote:
MM> > ()
MM> > () > /([<"'])(.*?)\1/ and print $2;
MM> > ()
MM> > () Doesn't work, because left and right delimiter are not equal for <>
MM> > ()
MM> > () /(["'<])(.*?)[\1>]/ and print $2;
MM> > ()
MM> > () should fix it.
MM> >
MM> >
MM> > Not really.
MM>
MM>
MM> In which case, could we instead of the
MM>
MM> [\1>]
MM>
MM> do
MM>
MM> \1|>$ (can get rid of the non-greediness then too)
This still fails, as \1 will match '<' before '>' gets a chance to
match.
MM> Also, if we are allowing <> possibilities, do not we also need to worry
MM> about [],{},() too.
Perhaps, I posted a regex that works for me, based on position,
instead of delimiter. Of course, as I said in my previous post
if his data is not consistent there will be false matches, as
the regex I posted was ~VERY~ general.
anm
--
BEGIN { $\ = $/; $$_ = $_ for qw~ just another perl hacker ~ }
my $J = sub { return \$just }; my $A = sub { return \$another };
my $P = sub { return \$perl }; my $H = sub { return \$hacker };
print map ucfirst() . " " => ${&$J()}, ${&$A()}, ${&$P()}, ${&$H()};
------------------------------
Date: Mon, 11 Sep 2000 00:39:36 GMT
From: "Ryan McKillen" <ryruns@aol.com>
Subject: timeout
Message-Id: <cRVu5.55497$d9.388311@typhoon.kc.rr.com>
I am working on a perl script right now and wondered if I could get some
help. The script is attached. This script uses LWP::Simple to check links
and make sure they work. I would like for it to timeout and consider a link
not working if it can't be validated in 20 seconds or less. Does anyone
know how to use perl's alarm() function to make this happen?
begin 666 links.cgi
M(R$O=7-R+V)I;B]P97)L#0H-"G5S92!,5U Z.E-I;7!L93L-"G5S92!$0DD[
M#0H-"B1D8E]D871A8F%S92 ](")M<#-D8B([#0HD9&)?=6ED(" @/2 B<F]O
M="([#0HD9&)?<'=D(#T@(FAN,&9S=&9U(CL-"@T*)&1B:" ]($1"22T^8V]N
M;F5C=" H(D1"23IM>7-Q;#HD9&)?9&%T86)A<V4B+B1M>7-Q;'-O8VLL("1D
M8E]U:60L("1D8E]P=V0I(&]R(&1I92@B8V]U;&0@;F]T(&-O;FYE8W0@=&\@
M9&)<;B(I.PT*)'-T:" ]("1D8F@M/G!R97!A<F4H(E-%3$5#5"!U<FP@1E)/
M32!F:6QE<R(I.PT*)'-T:" M/B!E>&5C=71E*"D[#0HD;G5M<F]W<R ]("1S
M=&@M/G)O=W,[#0H-"F9O<B H)&D@/2 P.R D:2 ]("1N=6UR;W=S.R K*R1I
M*2O=U]A<G)A>2D[#0H):68H*&AE
M860H)'5R;"DI(&]R("AG970H)'5R;"DI*2W
M;W)K<R([#0H)?2!E;'-E('L-"@D))'9A;&ED:71Y(#T@(F)R;VME(CL-"@D)
M)'9A;&ED7W5P9&%T92 ]("1D8F@M/F1O*")54$1!5$4@9FEL97,@4T54('9A
M;&ED(#T@=F%L:60@*R Q(%=(15)%('5R;" ]("<D=7)L)R(I.PD-"@E]#0H)
><')I;G0@(B1V86QI9&ET>2 M("1U<FQ<;B([#0I]
`
end
------------------------------
Date: Mon, 11 Sep 2000 01:13:53 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: timeout
Message-Id: <slrn8rocl8.586.tjla@thislove.dyndns.org>
I was shocked! How could Ryan McKillen <ryruns@aol.com>
say such a terrible thing:
>I am working on a perl script right now and wondered if I could get some
>help. The script is attached. This script uses LWP::Simple to check links
>and make sure they work. I would like for it to timeout and consider a link
>not working if it can't be validated in 20 seconds or less. Does anyone
>know how to use perl's alarm() function to make this happen?
>
>
>begin 666 links.cgi
Please don't post encoded files.
Did you read the alarm documentation? It gives a good explanation of
what you need to do.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Ummm, well, OK. The network's the network, the computer's the computer.
Sorry for the confusion.
-- Sun Microsystems
------------------------------
Date: Mon, 11 Sep 2000 13:22:04 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: using "|" as plain text in scripts (perl win)
Message-Id: <MPG.1426dec8d3bd225598976c@localhost>
Kourosh A Mojar <kmojar@bmjgroup.com> wrote ..
>im been trying to use "|" (pipe?) as pain text for creating flat
>database files. but does not allow my scripts to work properly. ive
>tried \| to try and cancel its command features but unsuccessful. i
>haven't found any examples in books and was hoping someone could give me
>a quick fix. can any one advise me on what is the best way to do this.
other responders have gone down a 'separator' path .. but I suspect that
you might be asking a different question
are you talking about using '|' as a filename in an open() call ? .. if
so you may want to have a read of the perlfaq5 answer to "How can I open
a file with a leading ">" or trailing blanks?"
perldoc -q open
it's the second entry
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Mon, 11 Sep 2000 01:47:45 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: What does "magic" mean?
Message-Id: <5RWu5.11465$CW2.114666@news1.rdc1.ct.home.com>
Shimon Bollinger <webmaster@wholefamily.com> wrote:
> Several Perl features are described as "magical". Is there a well defined
> technical meaning to "magical" or is it just a shortcut for "intuitive,
> though nonetheless surprising"? I checked out PERGUTS but am unilluminated.
Depends on the context. There's a specific feature of perl called magic,
which is something like a super-tie. The %ENV hash is magical, for
example, which is how reading from or writing to it changes your
environment. Tied variables are also magic, as is $! and $^E.
It's not that well documented, though. Scan through the mg.c and mg.h
files in the source tarball for a little more (well, OK, a *lot*
more) info. Not necessarily helpful info... but it's all in there.
Dan
------------------------------
Date: Mon, 11 Sep 2000 14:02:22 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: Where can I find information of perl internationalization?
Message-Id: <MPG.1426e83a9cd78f7c98976e@localhost>
Carfield Yim <carfield@programmer.net> wrote ..
>As title, I want to find information of using perl and perl regex to
>doing some text formatting job with Chinese, where can I find
>information of this?
the perllocale section of the documentation would be a good place to
start
perldoc perllocale
as well you might like to make sure that you have the latest version of
perl - 5.6 - which supports unicode and utf8
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Mon, 11 Sep 2000 00:45:05 +0200
From: Alain BARBET <alian@alianwebserver.com>
To: Ian Vincent <vincent@mail.igrin.co.nz>
Subject: Re: Where to download binary DBI and DBD::mysql for win32
Message-Id: <39BC0EF1.54E64711@alianwebserver.com>
Hi,
> I guess the title says it all... im looking (in vain) for a site where
> I can obtain a binary for win32 for Perl DBI and DBD::mysql driver.
>
> I currently have ActivePerl installed on Win98 and mySQL, all working,
> but the connectivity layer is illuding me at this point.
With Activestate you must use the .bat 'ppm'.
Run it in a dos box.
you can use the command search yourmodule and when you see the right
name, use install yourmodule.
HTH,
--
Alain & Estelle BARBET
http://www.alianwebserver.com
------------------------------
Date: Sun, 10 Sep 2000 23:54:10 GMT
From: vincent@mail.igrin.co.nz (Ian Vincent)
Subject: Re: Where to download binary DBI and DBD::mysql for win32
Message-Id: <39bc1cbb.18275545@news.igrin.co.nz>
Alian
I tried ppm.bat 'search yourmodule', as suggested, but I get the
returned error "no element found at line 1878, Column 0, byte 110815
at c:\Perl\site\lib\soap\parser.pm line 73", and PPM.bat closes.
However PPM 'query yourmodule' returns a listing of my installed
modules, so PPM seems to be OK.
Any idea what I should do next, seems my install is corrupt perhaps??
Any idea on the name and location of the DBI module, and is it
supposed to be automatically included in the ActivePerl install.
Lotsa questions I know,
TIA
Ian
On Mon, 11 Sep 2000 00:45:05 +0200, Alain BARBET
<alian@alianwebserver.com> wrote:
>Hi,
>
>> I guess the title says it all... im looking (in vain) for a site where
>> I can obtain a binary for win32 for Perl DBI and DBD::mysql driver.
>>
>> I currently have ActivePerl installed on Win98 and mySQL, all working,
>> but the connectivity layer is illuding me at this point.
>
>With Activestate you must use the .bat 'ppm'.
>Run it in a dos box.
>you can use the command search yourmodule and when you see the right
>name, use install yourmodule.
>
>HTH,
>--
>Alain & Estelle BARBET
>http://www.alianwebserver.com
------------------------------
Date: Sun, 10 Sep 2000 17:45:55 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: Where to download binary DBI and DBD::mysql for win32
Message-Id: <rXVu5.1090$ko1.386207@news.uswest.net>
"Ian Vincent" <vincent@mail.igrin.co.nz> wrote:
> I guess the title says it all... im looking (in vain) for a site where
> I can obtain a binary for win32 for Perl DBI and DBD::mysql driver.
>
> I currently have ActivePerl installed on Win98 and mySQL, all working,
> but the connectivity layer is illuding me at this point.
>
> Any help would be much appreciated
As others have said, use ppm.
"http://www.activestate.com/Products/ActivePerl/docs/faq/ActivePerl-faq2.htm
l"
C:> ppm
PPM> query
... [look at the modules you have installed]
PPM> search
... [search the server for the modules they have]
[lot's o' neat stuff. though not enough]
PPM> search DBI
[should show you the DBI module]
PPM> install DBI
[this will download and install the DBI module]
PPM> search DBD
[shows all the database drivers]
PPM> install DBD-mysql
[installs the mysql DBD]
PPM> quit
[done!]
Now try this code (this only requires the DBI).
#!<path to perl>
use DBI;
@dataSources = DBI->data_sources( "mysql" );
print "MySQL data sources:\n";
foreach $ds(@dataSources)
{ print "$ds\n"; }
###################
Then run this program, it'll show you your installed MySQL datasources.
------------------------------
Date: 11 Sep 2000 03:40:34 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: why does foreach iterate on an undef variable?
Message-Id: <8phk7i$sa5$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Martien Verbruggen
<mgjv@comdyn.com.au>],
who wrote in article <slrn8rdm2u.2cp.mgjv@verbruggen.comdyn.com.au>:
> If you want to say
>
> undef @array;
>
> you are free to do so, but semantically it doesn't mean much, or is at
> least ambiguous[1].
There is no other way to achieve what undef @array is doing: freeing
the storage accumulated in the array.
> [1] People might think you mean to assign undef to all elements of
> your array.
Applying a printed copy of Perl docs to the heads of such people can
achieve wonders (assuming an appropriate delta-vee).
Ilya
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 4280
**************************************