[12929] in Perl-Users-Digest
Perl-Users Digest, Issue: 339 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 2 19:07:24 1999
Date: Mon, 2 Aug 1999 16:05:13 -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 Mon, 2 Aug 1999 Volume: 9 Number: 339
Today's topics:
Re: [Summary] Korn Shell or Perl? (Stefaan A Eeckels)
Re: Announcement: "CRAP" (Greg Bacon)
Re: Beginner-friendly group as cultural adaptation? (Greg Bacon)
Re: Comparing Scalars <jverk@mediaone.net>
DBI - how to insert and retrieve BLOBs in Oracle 8i? <simont@mcw.edu>
Re: ebcdic packed numbers (Greg Bacon)
Re: FAQ 8.10: How do I read and write the serial port? (Greg Teets)
Re: General question about CHMOD (llornkcor@earthlink.net)
Goodbye clp.misc, Tad is checking out (was: why are you (Tad McClellan)
Re: Goodbye clp.misc, Tad is checking out (was: why are (I R A Darth Aggie)
Re: Goodbye clp.misc, Tad is checking out (was: why are (Larry Rosler)
Re: Goodbye clp.misc, Tad is checking out <revjack@radix.net>
Help - Perl/CGI on MS Personal Web Server. <zigouras@mail.med.upenn.edu>
Re: Help - Perl/CGI on MS Personal Web Server. makarand_kulkarni@my-deja.com
How can I know what modules are installed on server? <dnor@hiline.net>
HOW Do you use Perl to answer questions prompted from a <gregory_guerin@hp.com>
Re: How to determine a date in the past (elephant)
Re: how to remove cr/lf ??? (elephant)
Re: IP Validation (Alan Barclay)
Re: IP Validation <dummkopf@debussy.ucsc.edu>
Re: Logical Construction <anonymous@web.remarq.com>
Re: Looking for a Regular Expression to do an exact mat (Bart Lateur)
Re: Looking for a Regular Expression to do an exact mat (Mark-Jason Dominus)
Re: Looking for a Regular Expression to do an exact mat (elephant)
Re: Looking for a Regular Expression to do an exact mat (elephant)
newbabie, file's of 24 lines? <jcetek@ezzi.net>
Re: newbabie, file's of 24 lines? <laurens@bsquare.com>
Re: Newbie question about hashes (Larry Rosler)
Re: Newbie question about hashes makarand_kulkarni@my-deja.com
Re: PL_na issues (was ANNOUNCE: 5.005_58 perldelta page (Reini Urban)
Re: Problem reading forms with perl makarand_kulkarni@my-deja.com
Re: RegExp: Searching all items of an array (Bart Lateur)
Re: Running scrips on own pc (elephant)
Re: using __PACKAGE__ (Mark-Jason Dominus)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Aug 1999 20:06:11 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
Subject: Re: [Summary] Korn Shell or Perl?
Message-Id: <7o4tnj$3bo$1@justus.ecc.lu>
In article <7o4ko5$90g$1@lublin.zrz.tu-berlin.de>,
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> Tom Christiansen <tchrist@mox.perl.com> wrote in comp.lang.perl.misc:
>> [courtesy cc of this posting mailed to cited author]
>>
>>In comp.lang.perl.misc,
>> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
>>:originator of this thread was quetching about.
>>
>>I doubt whether in German you would pronounce them differently, but I
>>had thought that you'd really meant "kvetch" there, as least as we commonly
>
> I did, and corrected it in a superseding version of the article. The
> modern German cognate is "quetschen", which influenced me.
And we have our annual "Quetschefest", named after a fairly
sour elongated prune. From said fruit, we make "Quetschewäin",
"Aale Quetsch", "Quetschekraut" and lots of other goodies.
If you happen to be in Luxembourg on 12/09, please do pay
us a visit here in Harlange (or Harel (Letzebuergësch), or
Harlingen (Deutsch)), pop. 330. It's good fun, and you
help us keep the local musical traditions going.
--
Stefaan (playing the Eb bass tuba in the Harmonie Harlange)
--
PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
Perfection is reached, not when there is no longer anything to add,
but when there is no longer anything to take away. -- Saint-Exupéry
------------------------------
Date: 2 Aug 1999 21:51:34 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Announcement: "CRAP"
Message-Id: <7o53t6$kiv$3@info2.uah.edu>
In article <Pine.GSO.4.10.9908011503090.28810-100000@crusoe.crusoe.net>,
Jeff Pinyan <jeffp@crusoe.net> writes:
: http://www.pobox.com/~japhy/perl/crap
Ahem! <URL:http://www.pobox.com/~japhy/perl/crap/>
Greg
--
In the end, we had a visit from an embarrassed Digital Special Systems guy
who found an unused inverter pin and added some white wires. These days,
such a problem would be harder to fix in the field.
-- dmr
------------------------------
Date: 2 Aug 1999 21:40:21 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Beginner-friendly group as cultural adaptation?
Message-Id: <7o5385$kiv$1@info2.uah.edu>
In article <Coq$PGA2uuo3EwH8@beausys.freeserve.co.uk>,
Andrew Fry <andrewf@beausys.demon.co.uk> writes:
: How very patronising.
What a useless contribution. Perl comes with all its documentation in
POD, a very legible format. Champions of various ports provide the
documentation in various other formats. Please point out specific
issues you have with Tom's statement.
comp.lang.perl.misc would be much more `beginner friendly' (and,
consequently, this same stupid thread wouldn't pop up periodically)
if the beginners would just read the frigging documentation.
Greg
--
In an intellectually equal society, who will be the busboys?
-- Lenny Bruce
------------------------------
Date: Mon, 02 Aug 1999 21:35:18 GMT
From: Jennifer <jverk@mediaone.net>
Subject: Re: Comparing Scalars
Message-Id: <7o52ul$943$1@nnrp1.deja.com>
Thanks for the help. I really appreciate it. After awhile of trying
different things, I came up with:
if ($software eq "" && $service eq "" && $workaround eq "") {
close(SUBMIT);
} else {
I knew eventually I would get something to work. I'm just glad to see
that it was right.
Thanks again.
Jennifer
In article <37a0c85f@cs.colorado.edu>,
tchrist@mox.perl.com (Tom Christiansen) wrote:
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc, jverk@mediaone.net writes:
> :I'm having a problem comparing 3 scalars. In english, here's what
I'm
> :trying to do:
> :
> :if $scalar1 and $scalar2 and $scalar3 eq ""
> : then do this
> :else do this
> :
> :My problem is I don't know the correct way to write the comparison
> :between the variables. If all three variables are null, then do
this.
>
> There is no null.
>
> :If at least one of the variables has a value (any value) then do
this.
>
> :But how do I write this?
>
> Since I get to use any value, I'm going to choose 37. It's a nice
value.
> Let's say you want to see whether $scalar1 and $scalar2 are both equal
> to 37.
>
> if ($scalar1 == 37 && $scalar2 == 37) {
> # do case when both are 37
> } else {
> # do case when either one isn't 37
> }
>
> Of course, if you had chosen as your random value "perl", then it
would
> look rather different; that is:
>
> if ($scalar1 eq 'perl' && $scalar2 eq 'perl') {
> # do case when both are perl
> } else {
> # do case when either one isn't perl
> }
>
> And of course, if you have Perlian Nature, instead of numeric or
> stringwise equality, you might write something more like this:
>
> if ($scalar1 =~ /^perl$/ && $scalar2 =~ /^perl$/) {
> # do case when both are perl
> } else {
> # do case when either one isn't perl
> }
>
> or more conservatively like this:
>
> if ($scalar1 =~ /^\s*perl\s*$/si && $scalar2 =~ /^\s*perl\s*$/si)
{
> # do case when both are perl
> } else {
> # do case when either one isn't perl
> }
>
> This doesn't extend well to a zillion values. However, this isn't
bad:
>
> if (3 == grep { $_ == 37 } $scalar1, $scalar2, $scalar3) {
> # do case when all three variables are 37
> } else {
> # do case when at least one isn't 37
> }
>
> or
>
> if (3 == grep { $_ eq 'perl' } $scalar1, $scalar2, $scalar3) {
> # do case when all three variables are perl
> } else {
> # do case when at least one isn't perl
> }
>
> And the pattern version is nifty:
>
> if (3 == grep { /^perl$/ } $scalar1, $scalar2, $scalar3) {
> # do case when all three variables are perl
> } else {
> # do case when at least one isn't perl
> }
>
> if (3 == grep { /^\s*perl\s*$/si } $scalar1, $scalar2, $scalar3) {
> # do case when all three variables are perl
> } else {
> # do case when at least one isn't perl
> }
>
> That's a bit magical though, because if you add $scalar4, you might
> forget to cahnge the leading 3 to 4. It's slightly better in the
> case of a generic array.
>
> if (@array == grep { $_ == 37 } @array) {
> # do case when all members of the array are 37
> } else {
> # do case when at least one isn't 37
> }
>
> or with eq:
>
> if (@array == grep { $_ eq 'perl' } @array) {
> # do case when all members of the array are perl
> } else {
> # do case when at least one isn't perl
> }
>
> or case-insensibly with eq:
>
> if (@array == grep { lc() eq 'perl' } @array) {
> # do case when all members of the array are perl
> } else {
> # do case when at least one isn't perl
> }
>
> or embracing the Path of Perl, with a pattern match:
>
> if (@array == grep { /^perl$/si } @array) {
> # do case when all members of the array are perl
> } else {
> # do case when at least one isn't perl
> }
>
> And yes, these pretty much all whinge at you if something isn't
defined
> and you didn't forget to use the -w flag, like if there are holes in
> the array. But you often want this alert.
>
> Since I can use any value, I'll now define "any value" to be "any true
> value". Life if really very much simpler if you can manage arrange
your
> data so this definition works for you. Often you can.
>
> if ($scalar1 || $scalar2 || $scalar3) {
> # do case when one or more are true
> } else {
> # do case when all are false
> }
>
> or you could use
>
> unless ($scalar1 || $scalar2 || $scalar3) {
> # do case when all are false
> } else {
> # do case when one or more are true
> }
>
> Which is much better than some crazy De Morgan transformation.
>
> If you're wholly concerned about holes:
>
> if (@array == grep { defined() } @array) {
> # do case when all members of the array are defined
> } else {
> # do case when at least one isn't defined
> }
>
> I'll bet you didn't expect this posting. :-)
>
> --tom
> --
> Fancy algorithms are slow when n is small, and n is usually small.
--Rob Pike
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 02 Aug 1999 16:22:48 -0500
From: Simon Twigger <simont@mcw.edu>
Subject: DBI - how to insert and retrieve BLOBs in Oracle 8i?
Message-Id: <37A60C28.81E9C394@mcw.edu>
Hi there,
I'm writing a perl/CGI/web based application which is using an Oracle8i
database to store assorted data. What I would like to be able to do is
have people upload files to the database (eg. Excel, PDF, images, etc)
where they would be stored and then served back for download or on-line
viewing as required.
At the moment I can get the data onto the server saved as a file on the
disk, with a filename stored in the database. I then use the stored
filename to create a link to the file saved on the local filesystem.
What I would rather do is have the file stored completely in the
database and not on the local filesystem, and have a link to a script
that served the file up directly from the database. I have DBI up and
running but I dont know how to go about inserting binary data into the
database using DBI and similarly I dont know how to read it back out
again to serve up to the browser in response to a request.
Can anyone enlighten me on how to achieve this or point me towards any
examples?
Many thanks for any help!
Simon.
--
--------------------------------------------------
Simon Twigger, Ph.D.
Laboratory for Genetic Research,
Cardiovascular Research Center,
Medical College of Wisconsin,
8701 Watertown Plank Road,
Milwaukee, WI, 53226
http://legba.ifrc.mcw.edu/~simont/
tel. 414-456-4409 fax. 414-456-6516
--------------------------------------------------
------------------------------
Date: 2 Aug 1999 21:47:41 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: ebcdic packed numbers
Message-Id: <7o53lt$kiv$2@info2.uah.edu>
In article <37a5b157.2433067@news.skynet.be>,
bart.lateur@skynet.be (Bart Lateur) writes:
: But you can, at least, represent rationals by a ratio of two bignums? If
: you can't, they're no rationals.
Performance in that case would easily fit in one bit: 0.
Greg
--
An authority is a person who can tell you more about something than you really
care to know.
------------------------------
Date: Mon, 02 Aug 1999 22:47:53 GMT
From: teetsg@fuse.net (Greg Teets)
Subject: Re: FAQ 8.10: How do I read and write the serial port?
Message-Id: <37a61e28.33984567@nntp.fuse.net>
I have downloaded the Win32::SerialPort module from CPAN,
Unfortunately, this is the first time I have tried to use a module.
Based on the readme file, I ran perl install.pl. However, when I
tried to run my Perl script, I got the following:
C:\Perl\bin>perl example1.pl
Can't locate Win32/API.pm in @INC (@INC contains: C:/Perl/lib
C:/Perl/site/lib .
) at C:/Perl/site/lib/Win32API/CommPort.pm line 5.
BEGIN failed--compilation aborted at
C:/Perl/site/lib/Win32API/CommPort.pm line
5.
BEGIN failed--compilation aborted at
C:/Perl/site/lib/Win32/SerialPort.pm line 4
.
BEGIN failed--compilation aborted at example1.pl line 2.
I have no idea what all this means.
Please let me know how to install it properly. I am using the
ActiveState that I downloaded on July 31.
Thanks
Greg
>
>On Win32, so much differs that a separate Win32::SerialPort
>module was created to manage accesssibility, parameters,
>tied filehandles, and the other issues. Available from CPAN.
>
>-bill
>Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: 02 Aug 1999 15:11:11 -0600
From: llornkcor@earthlink.net (llornkcor@earthlink.net)
Subject: Re: General question about CHMOD
Message-Id: <wkiu6xhor4.fsf@earthlink.net>
ahh- but this DOES have something to do with perl. You must chmod ANY
perl script to get it to run on unix systems, right???
anyway- to kindly answer your question, chmod 777 IS a security risk,
giving read, write, and execute permission to EVERYONE in the whole
world. That means, anyone could delete any PERL scripts. chmod 775 is
better, and chmod 755 even better, depending on just who you are.
"Donboy" <webmaster@roleplayinggames.net> writes:
>Hey everyone. I don't normally post on this discussion group, but I've got
>a question that I can't seem to otherwise find an answer to.
>
>I run a website that has LOTS of message boards and various Perl scripts, so
>I have LOTS of pages that are CHMOD to 777. My question is whether or not
>777 is a big security risk. Will CHMOD 777 open me up to potential hackers
>and whatnot because the security is not good enough??
>
>Followup question: If 777 is too insecure, what other setting could I use
>that would give me the same functionality but better security?
>
>Are there any good websites that explain the dangers of CHMOD to 777 (etc)??
>
>
--
llornkcor rocknroll
SpiritShip MultiMedia Recording Studio
www.llornkcor.com
(0 0)
+=======================----oOO--(_)--OOo----=========================+
__ _
/ / (_)__ __ ____ __
/ /__/ / _ \/ // /\ \/ /
/____/_/_//_/\_,_/ /_/\_\ The choice of a GNU generation...
------------------------------
Date: Mon, 2 Aug 1999 12:50:37 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Goodbye clp.misc, Tad is checking out (was: why are you so harsh to this guy ?)
Message-Id: <t8i4o7.1i5.ln@magna.metronet.com>
Jeff Kerrigan (jeff_kerrigan@hotmail.com) wrote:
: Tad McClellan wrote:
: > Thomas Schmickl (schmickl@magnet.at) wrote:
: > : Tad McClellan schrieb:
: > : > Stop it!
: > : >
: > : > Your time is NOT more valuable than everyone else's.
: > : >
: > : > Spend _some_ of yours before asking others to spend their's.
: >
: > : Do you really have to be so unpolite to this guy ???
: >
: > Yes.
: Get a life.
I assume that you disagree with something I said.
But you gave no indication of what it is that you disagree with!
(and you quoted the entire thing. And you added your comments in
Jeopardy order)
Do you think it is OK to reask a Frequently Asked Question?
Do you think someone who time after time continues to reask
Frequently Asked Questions should be treated as if they had
done nothing wrong?
Do you remain silent when someone takes cuts in line in front of you?
(those are all rhetorical questions, as I ain't gonna be seeing
any followups. Or any other postings to clp.misc for that matter)
: If you were half as great as you thought you were, Tad, you wouldn't have time
: to give 25,000 word responses to every "newbie" who writes to this NG.
You are right.
I have wasted an inordinate amount of time here. I thought I was
helping people, but clearly I have not been.
I quit.
I am leaving comp.lang.perl.misc.
I have learned a lot about Perl in the 5 years and 9,000 posts
worth of participating in this newsgroup.
Thanks everybody!
If you should happen to be glad to see me go, then please send
Jeff an email (don't want to clutter up the newsgroup with this
silliness) and congratulate him for getting rid of the scourge
of clp.misc.
If, OTH, you happen to be one of the very few who has derived some
benefit from my postings, please send him an email to let him
know that too.
Now I'll have lots more time to play with my daughter.
I'm going to go do that right now...
So long folks! :-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 2 Aug 1999 22:07:41 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Goodbye clp.misc, Tad is checking out (was: why are you so harsh to this guy ?)
Message-Id: <slrn7qc5pj.r99.fl_aggie@thepentagon.com>
On Mon, 2 Aug 1999 12:50:37 -0400, Tad McClellan <tadmc@metronet.com>, in
<t8i4o7.1i5.ln@magna.metronet.com> wrote:
[posted && cc'd]
+ I am leaving comp.lang.perl.misc.
Too bad. clpm will be poorer for it. Oh, well. Usenet goes on. And the
newbie you will have with you always.
+ Now I'll have lots more time to play with my daughter.
I'd say that's slightly more important than posting to Usenet. IMHO,
that is. I have no such impediment, so I'll continue roasting the
occasional newbie. It's a poor substitute, but what the hell...
When are you going to start teaching her perl? :)
+ So long folks! :-)
And thanks for all the fish.
James
------------------------------
Date: Mon, 2 Aug 1999 15:31:30 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Goodbye clp.misc, Tad is checking out (was: why are you so harsh to this guy ?)
Message-Id: <MPG.120fbc209b73014b989da0@nntp.hpl.hp.com>
In article <slrn7qc5pj.r99.fl_aggie@thepentagon.com> on 2 Aug 1999
22:07:41 GMT, I R A Darth Aggie <fl_aggie@thepentagon.com> says...
> On Mon, 2 Aug 1999 12:50:37 -0400, Tad McClellan <tadmc@metronet.com>, in
> <t8i4o7.1i5.ln@magna.metronet.com> wrote:
...
> + So long folks! :-)
>
> And thanks for all the fish.
Don't you mean 'fishing lessons'? :-(
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 2 Aug 1999 22:26:20 GMT
From: revjack <revjack@radix.net>
Subject: Re: Goodbye clp.misc, Tad is checking out
Message-Id: <7o55uc$m7b$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
[posted & mailed]
Tad McClellan explains it all:
: I am leaving comp.lang.perl.misc.
Consider a sabbatical instead. Like 6 months or so. No need to be final.
Things change.
------------------------------
Date: Mon, 2 Aug 1999 17:33:04 -0400
From: Nico Zigouras <zigouras@mail.med.upenn.edu>
Subject: Help - Perl/CGI on MS Personal Web Server.
Message-Id: <Pine.OSF.4.05.9908021728300.29030-100000@mail.med.upenn.edu>
Hi:
I am having problems configuring MS PWS for Perl/CGI. I can run Perl fine
from command line. I think i associated the .pl extension with it OK.
When I try to run a script I get the following error:
-------
HTTP Error 403
403.1 Forbidden: Execute Access Forbidden
This error can be caused if you try to execute a CGI, ISAPI, or other
executable program from a directory that does not allow programs to be
executed.
Please contact the Web server's administrator if the problem persists.
--------
Sometimes I get a login pop up window when I try to access it.
Any help would be much appreciated. Please also reply to my email.
------------------------------
Date: Mon, 02 Aug 1999 22:36:53 GMT
From: makarand_kulkarni@my-deja.com
Subject: Re: Help - Perl/CGI on MS Personal Web Server.
Message-Id: <7o56i4$bkv$1@nnrp1.deja.com>
--
Looks like you have to add entries in you
webserver config file and marking the
directory of your script as a CGI directory.
You will have to refer to your webserver's
documentation to do this.
--
> -------
> HTTP Error 403
> 403.1 Forbidden: Execute Access Forbidden
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 2 Aug 1999 16:59:36 -0500
From: "99% Energy" <dnor@hiline.net>
Subject: How can I know what modules are installed on server?
Message-Id: <ouop3.23$k8.8951@newscene.newscene.com>
Hello,
I am trying to run a script that uses CGI, PWL, etc libraries in a web
hosting server. I downloaded the libraries from CPAN and installed them in
my computer, which runs win98. The script that uses these additional
libraries runs fine in my computer.
I uploaded the script to the web hosting server (www.icom.com) and the
script failed. I uploaded the libraries to the cgi-bin\lib directory (I had
to create the directory) and the script still failed. I am tempted to
butcher the library modules and make a large script with all the functions
but I know this is not the right solution.
Other scripts which do not use library modules run fine on the server.
How can I tell what modules are installed on a server? How can I replicate
the library enviroment in my machine so it is the same as on the server so I
won't run into these type of complications?
BTW, I do not have Telnet access to the server, only FTP.
99% Energy
------------------------------
Date: Mon, 02 Aug 1999 15:08:16 -0600
From: Greg Guerin <gregory_guerin@hp.com>
Subject: HOW Do you use Perl to answer questions prompted from a ksh script
Message-Id: <37A608C0.A2D6D51@hp.com>
Hi,
I am trying to use perl to answer questions that a ksh script is
generating. The ksh script will be started within the perlscript and
then the question/answers begin. Any ideas on how to do this would be
most appreciated. Thank you.
Greg
mailto: gregory_guerin@hp.com
------------------------------
Date: Tue, 3 Aug 1999 08:13:22 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: How to determine a date in the past
Message-Id: <MPG.1210c30a9ba3df6e989bb1@news-server>
Eric The Read writes ..
>Well, I jumped on you too quickly here, and I apologize.
at the risk of making the old timers puke .. that's ok Eric .. jumping on
people is the way this group works .. and certainly I've jumped (and will
continue to jump in the future) too quickly many a time
> But I was
>thinking specifically of the case where the DST line is crossed, and
>counting back a specific number of seconds *isn't* the same as counting
>back a given number of days.
yes .. obviously this is true .. but only during two hours of every year
- an inaccuracy that MOST applications can live with
the other case - as I think Abigail demonstrated - is the fact that the
time functions all ignore leap seconds - so if you try to go back 100
years in seconds per day - then you're out by a considerable margin
again .. most applications do not try to go back 100 years .. in fact
most of the time it's like a week or something .. but - as I've already
said - I certainly should have mentioned those caveats in my original
post
>As I mentioned to the author of Date::Manip when he wrote to me in
>support of your post, I tend to find a module that works and stick with
>it.
there are cases when everyone does that I'm sure .. I guess I see a big
difference between doing that yourself and advising others to do it
Date::Manip is an excellent module for taking bizarre times and dates -
especially human entered - and parsing them .. when you don't know your
input it's a dream come true
Date::Calc is brilliant for any date calculation that requires calendar
accuracy
--
jason - remove all hyphens for email reply -
------------------------------
Date: Tue, 3 Aug 1999 08:39:05 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: how to remove cr/lf ???
Message-Id: <MPG.1210c914ef27a5c3989bb3@news-server>
Dan Wilga writes ..
>$outbuffer =~ s/\n/;/g;
>print FILETO $outbuffer;
>
>(This assumes your machine treats \n as CR-LF. This is the case if you're
>on a PC.)
a PC ? .. so you mean if I run Linux or NT on my PC then my line endings
are still the same as DOS ? .. oh man - what a ripoff - I'm taking this
thing back
why assume anything .. Ming knows which characters to replace .. why not
replace them by name - explicitly ?
using the vars from the original question we get
$outbuffer =~ s/\cM\cJ/;/g;
print FILETO $outbuffer;
--
jason - remove all hyphens for email reply -
------------------------------
Date: 2 Aug 1999 21:57:10 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: IP Validation
Message-Id: <933634628.12460@elaine.drink.com>
In article <37A5EC66.647FC95D@debussy.ucsc.edu>,
Helmut Katzgraber <dummkopf@debussy.ucsc.edu> wrote:
>
>that is still not good enough. look into the o'reilly book "mastering
>regular expressions". there they make an elaborate example on how to do
>it right. your regex should look like this:
>
>([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$
>
>quiet a monster, but it will only match valid IPs.
No, it matches only valid IP's consisting of dotted quads. It fails to match
3475931797, a perfectly valid IP for one of Microsoft's webservers, or
0xcf2e8295, an alternative notation for the same address.
------------------------------
Date: Mon, 02 Aug 1999 15:23:21 -0700
From: Helmut Katzgraber <dummkopf@debussy.ucsc.edu>
Subject: Re: IP Validation
Message-Id: <37A61A59.34E943B6@debussy.ucsc.edu>
> No, it matches only valid IP's consisting of dotted quads. It fails to match
> 3475931797, a perfectly valid IP for one of Microsoft's webservers, or
> 0xcf2e8295, an alternative notation for the same address.
you are right. i just assumed that that is what the original poster
wanted to do. if you need to match other IPs, like the ones you
suggested just put the mombo-combo i wrote within parentheses and make
an | after it adding more rules to get the other IPs.
sorry if i did not post a complete solution.
cheers, h.
--
-----------------------------------------------------------------
Helmut G. Katzgraber mail: dummkopf@debussy.ucsc.edu
Physics Department, Kerr Hall http://debussy.ucsc.edu/~dummkopf
University of California Phone: (+1) 831-459-4762
Santa Cruz, CA 95064, USA Fax: (+1) 831-459-3043
-----------------------------------------------------------------
------------------------------
Date: Mon, 02 Aug 1999 14:35:49 -0800
From: Samay <anonymous@web.remarq.com>
Subject: Re: Logical Construction
Message-Id: <933633353.8992@www.remarq.com>
Well, yes that's exactly what I want to do.
the only problem is that MY foreach construct is very long.
so, I just want to put it in some type of subroutine and
whenever I call, I just want to get the next item.
Typically what you said about subroutine is true that it
will return the first item only everytime. I am just
thinking of tweaking it someway to return next item and not
the first item all time. In the while construct I would
like to have returned NULL type of thing if there's no more
data.
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Mon, 02 Aug 1999 21:25:54 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Looking for a Regular Expression to do an exact match case indepenent
Message-Id: <37a806a9.1715966@news.skynet.be>
Tom Christiansen wrote:
>In comp.lang.perl.misc,
>Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu> writes:
>: or, given that you're using SQL anyway, how about
>: $teststring LIKE 'computer administration'
>
>Clever. Maybe in perl6 we'll see a "LIKE" operator as a
>more legible version of the "=~" operator.
I really can't see how one can use a regex in SQL, anyway.
Bart.
------------------------------
Date: Mon, 02 Aug 1999 22:10:32 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Looking for a Regular Expression to do an exact match case indepenent
Message-Id: <7o54vp$cqs$1@monet.op.net>
In article <37a5bd10@cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>Maybe in perl6 we'll see a "LIKE" operator as a
>more legible version of the "=~" operator.
Yeah, but with really low precedence, analogous to `and' and `or'.
That way it could also be used in
$modified = $orig LIKE s/nosehair/vibrissa/g;
I like that a lot better than your ~~ idea.
------------------------------
Date: Tue, 3 Aug 1999 08:52:37 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Looking for a Regular Expression to do an exact match case indepenent
Message-Id: <MPG.1210cc44483cbbec989bb5@news-server>
[ item posted to comp.lang.perl.misc and CCed to Keith S ]
Keith S writes ..
>I'm using the "Regular Expression" that are provided in Mysql Database engine.
so get stuffed - and read the MySQL documentation
http://www.mysql.com/doc.html
there are only about a billion pages of it .. and a list of mailing lists
longer than your arm .. and a documentation search facility on the web
page .. and a mailing list archive search facility .. and a list of
goddamn books .. and and and..........
--
jason - remove all hyphens for email reply -
------------------------------
Date: Tue, 3 Aug 1999 08:46:56 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Looking for a Regular Expression to do an exact match case indepenent
Message-Id: <MPG.1210caee4be1cae1989bb4@news-server>
Bart Lateur writes ..
>I really can't see how one can use a regex in SQL, anyway.
MySQL has a regex syntax .. fully documented (as you'd imagine) in the
MySQL documentation .. nothing to do with perl
--
jason - remove all hyphens for email reply -
------------------------------
Date: Mon, 2 Aug 1999 17:44:27 -0400
From: "ezzi" <jcetek@ezzi.net>
Subject: newbabie, file's of 24 lines?
Message-Id: <Kgop3.979$mH2.143648@typ12.nn.bcandid.com>
hi
I've only been programming in perl for two week. I'm having a problem with
read a file of 24 lines long. thankz, for any help.
------------------------------
Date: Mon, 2 Aug 1999 15:19:26 -0700
From: "Lauren Smith" <laurens@bsquare.com>
Subject: Re: newbabie, file's of 24 lines?
Message-Id: <7o55hr$1j6$1@brokaw.wa.com>
ezzi wrote in message ...
>I'm having a problem with read a file of 24 lines long.
Now that's really weird. I'd think it would be fairly similar to reading a
file with 10 or 20 or 100 lines. Maybe it's a glitch in your installation
of Perl. I sure don't know.
perldoc -f open
Lauren
------------------------------
Date: Mon, 2 Aug 1999 14:32:54 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie question about hashes
Message-Id: <MPG.120fae601dc51112989d9f@nntp.hpl.hp.com>
In article <37A60330.43A938C@dds.nl> on Mon, 02 Aug 1999 22:44:33 +0200,
Niek Slatius <nslatius@dds.nl> says...
...
> In my script I've a hash called %FORM. This thread implements all names
> from my HTML form with it's corresponding values.
> So for instance: $FORM{'name'} is John. What I want to do is lowercase
> all values of this hash.
We just talked about the undesirable use of all upper-case letters for
variables. Oh, well!
> I started of trying this code:
>
> foreach values %FORM{
> $FORM{$a} = lc $FORM{$a};
> }
The syntax is wrong, so how could you have tried it?
> No good :'-(
No surprise. :-)
> I've tried this code:
>
> foreach values %FORM ($value){
> $value = lc $value;
> }
The syntax is wrong, so how could you have tried it?
> That didn't work either :'-(
No surprise. :-)
> What a'm I missing here? Don't tell me I need to put the values of %FORM
> in an array first, then lowercase those values and then put 'em back in
> a hash again please (except of course if that's the only solution) ;-)
What you want to use is the 'keys' function.
foreach my $key (keys %FORM) {
$FORM{$key} = lc $FORM{$key};
}
Or, more succinctly (assuming perl 5.005),
$FORM{$_} = lc $FORM{$_} for keys %FORM;
If the hash is very large, creating the list of keys may be burdensome,
so you can use the 'each' funcion instead:
while (my ($key, $val) = each %FORM) {
$FORM{$key} = lc $val;
}
or
while (my $key = each %FORM) {
$FORM{$key} = lc $FORM{$key};
}
or
$FORM{$_} = lc $FORM{$_} while $_ = each %FORM;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 02 Aug 1999 21:58:04 GMT
From: makarand_kulkarni@my-deja.com
Subject: Re: Newbie question about hashes
Message-Id: <7o5496$9vf$1@nnrp1.deja.com>
--
try this
foreach ( keys %FORM ) { $FORM {$_} = lc ( $FORM{$_) } ;
You have to loop on keys and not values.
--
>
> I started of trying this code:
>
> foreach values %FORM{
> $FORM{$a} = lc $FORM{$a};
> }
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 02 Aug 1999 21:17:30 GMT
From: rurban@xarch.tu-graz.ac.at (Reini Urban)
Subject: Re: PL_na issues (was ANNOUNCE: 5.005_58 perldelta page)
Message-Id: <37a6058b.36077416@judy.x-ray.local>
hmm, i have 187 modules here with approx. 50% using xsubs waiting to be
fixed. and i'm sure i'll have to do it by myself for 5.006.
so i asked for the recommended way to fix all these modules from
different authors without having to think of how to replace the global
"na" with a local one. and with keeping the backdoor for older versions.
i will not be the only one.
BerkeleyDB-0.06 was the first which refused to compile with 5.00558 and
POLLUTE=1, many others as well.
but POLLUTE=1 seems to be really the easiest way beforehand.
everything is else is a hack.
somewhen the binary compatibility must end. sigh.
jan.dubois@ibm.net (Jan Dubois) wrote:
>rurban@xarch.tu-graz.ac.at (Reini Urban) wrote:
>>what is the recommended c preprozessor conditional to switch between na
>>and PL_na resp. the old POLLUTEd and the new 5.006 names?
>
>The "recommended" solution is *not* to use "na" at all but to define a
>local variable, like:
>
> STRLEN n_a;
>
>and use that instead. The reason is that PL_na under threaded Perl becomes
>a per-thread variable. You'll then need to add a dTHR definition to your
^^^^
this is my problem. these are not my functions. :(
but the issue is getting clearer and clearer to me...
>function to access PL_na, which will be an expensive access to
>thread-local storage. Adding a local STRLEN variable is cheap, backward
>compatible and doesn't need preprocessor conditionals. It is also what is
>being used in the Perl core.
>
>-Jan
--
Reini
------------------------------
Date: Mon, 02 Aug 1999 21:44:45 GMT
From: makarand_kulkarni@my-deja.com
Subject: Re: Problem reading forms with perl
Message-Id: <7o53ga$9fv$1@nnrp1.deja.com>
-
When you use forms the user is expected to type
plain text. Plain text by definition does
not include '<' or '>' or '&'. These have
special meaning in HTML and are interpreted
as HTML tags and are lost.
-
Makarand Kulkarni
> The problem is that when a user enters "<" in the text area, the
> following text does not make it to the file. So if the user
> types "a<b>c", the file winds up with "ac" written to it.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 02 Aug 1999 21:25:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: RegExp: Searching all items of an array
Message-Id: <37a705ab.1462707@news.skynet.be>
marcza@my-deja.com wrote:
>I want to find out if in column 2 to 6 of each array item
>the text "date" is written.
>The array has say 8 items.
>I want to do that without a loop.
>The following doesn't work:
>
>if (substr($array[[0-7]],3,4) =~ /date/) { ... }
>
>But I feel that it should work somehow.
No it doesn't. Because you want to check 8 items, all for the same test.
You need a loop, but it may be hidden. And @data[0..7] would have been a
better guess than $data[[0..7]], anyway.
Try to look out for anything that fails. I f none fail, all is well.
unless (grep { substr($_,3,4) ne 'date' } @data[0..7]) {
print "All is well!";
}
Bart.
------------------------------
Date: Tue, 3 Aug 1999 08:20:02 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Running scrips on own pc
Message-Id: <MPG.1210c4993eb5ced8989bb2@news-server>
David Turley writes ..
>http://www.binary.net/dturley/cgi_testing.html
Microsoft's web servers too scarey for you ? .. they're really very
simple to setup .. less to do than with Apache
not that I prefer them - but your web page seems to be saying that it's
really complicated .. that's more a statement about you than about
Microsoft
don't forget that Microsoft is the choice of the point-and-click
generation .. editing conf files is often WAY beyond them
--
jason - remove all hyphens for email reply -
------------------------------
Date: Mon, 02 Aug 1999 21:58:36 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: using __PACKAGE__
Message-Id: <7o549d$cns$1@monet.op.net>
In article <7o4pov$1qv$1@nnrp1.deja.com>, <jschueler@tqis.com> wrote:
> print $__PACKAGE__::hello, "\n" ;
>
>I would prefer that this script print "world" instead of a blank line.
>Is there some idiom I need to use?
print ${__PACKAGE__ . '::hello'}
You're doing an implict concatenation operation there, and Perl
doesn't have implicit concatenation except inside of "..." strings.
So you need the . to make Perl do the concatenation of the package
name and the :: and the variable name.
>Can anyone advise where I ought to have looked for this answer?
Grepping the documenation is sometimes a good bet.
------------------------------
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". 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 V9 Issue 339
*************************************