[7109] in Perl-Users-Digest
Perl-Users Digest, Issue: 734 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 14 21:08:46 1997
Date: Mon, 14 Jul 97 18:00:22 -0700
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, 14 Jul 1997 Volume: 8 Number: 734
Today's topics:
Re: [q] building perl5 on irix 6.2 (Peter Lees)
Re: [Q] Perl-5.004, localtime & timelocal (Paul Eggert)
Re: Can I do that?? <rootbeer@teleport.com>
could someone look over my code? <josh@palouse.org>
Re: Dear Spammer! We are NOT happy with you. (Wayne and Heather Borean)
HELP needed for socket programming <sysadm@twd.net>
Re: Help! Need to run a script! <guitarweb@hotmail.com>
Re: Help!: List of Lists; Programming Perl, page 258 <rootbeer@teleport.com>
Re: help-print using labels gives error (update) <rootbeer@teleport.com>
Re: How to round numbers in perl <rootbeer@teleport.com>
Re: How to substract a uniq integer from a ASCI string <dm0@avana.net>
Implmenting flock (Joseph Davidson)
Re: Is remote registry administration possible for Wind (Mark Nielsen)
Re: Learning Perl ..Help?? <merlyn@stonehenge.com>
Re: Newbie confusion <rootbeer@teleport.com>
Re: regexp- capturing matched pattern with an alternati <rootbeer@teleport.com>
Script CGI to UPLOAD a WEB SERVER <lory@sesm.it>
Socket programming for web based chat server <sysadm@twd.net>
Re: String Comparison <rootbeer@teleport.com>
Re: Webmasters??? <guitarweb@hotmail.com>
Re: windows 95 perl (Chris Schleicher)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Jul 1997 00:11:20 GMT
From: peter@junior.next.com.au (Peter Lees)
Subject: Re: [q] building perl5 on irix 6.2
Message-Id: <5qef78$4h4@inferno.mpx.com.au>
On 14 Jul 1997 01:55:50 GMT, Peter Lees (peter@junior.next.com.au) wrote:
> i'm having an 'interesting' time building perl on SGI IRIX 6.2
> with SGI cc.
> i'm getting lots of warnings about ANSI defines being undefined, but
> more importantly the DB_File dynamic module doesn't want to build:
> Making DB_File (dynamic)
> LD_RUN_PATH="/usr/local/lib" cc -o ../../lib/auto/DB_File/DB_File.so -shared -L/usr/local/lib DB_File.o -L/usr/local/lib -ldb
> ld: ERROR 48: Cannot access registry file ./so_locations (No locks available) - ignored.
> ld: FATAL 51: Can't assign virtual addresses for DB_File.so within specified range. Please check your registry file ./so_locations.
> *** Error code 1 (bu21)
> *** Error code 1 (bu21)
i found the problem was trying to run ld over a NFS mounted filesystem
- when i moved to a local filesystem everything worked OK.
p
--
Peter Lees (peter@next.com.au) - Technical Manager, Next Online
tel: +61 2 9310 1433 * fax: +61 2 9310 1315 * http://www.next.com.au
"You can have a day off when you're dead, Baldrick, and not before..."
------------------------------
Date: 14 Jul 1997 11:08:46 -0700
From: eggert@twinsun.com (Paul Eggert)
Subject: Re: [Q] Perl-5.004, localtime & timelocal
Message-Id: <5qdpve$jgc$1@tattoo.twinsun.com>
Keywords: Perl-5.004, localtime, timelocal
mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:
> There is a bug in Time::Local which causes it to give wrong answers if
> the timezone offset has changed since Jan 1st 1970. This has happened
> in Singapore but AFAIK not anywhere else.
You underestimate the flexibility of politicians. Time zone offset
changes have happened to billions of people since 1970. Here's a
partial list of locations that have a different time zone offset now
than they did in 1970. These are locations where Time::Local does not
work if your OS has accurate time zone tables:
Alaska (except for a small region around Yakutat)
Algeria
Bahrain
Bhutan
Britain
Cape Verde
China (except longitudes near Beijing's)
Estonia
Georgia
Guinea-Bissau
Ireland
Latvia
Liberia
Libya
Lithuania
Malaysia (peninsular)
Moldova
Sri Lanka
Ukraine (except Crimea)
Western Sahara
If you count regions that have changed and changed back (so they have
experienced this bug some time in the past), the list grows: e.g. it
includes Portugal and Russia.
Time::Local was a fun hack when it was first written but it should be
taken out and shot -- it's way too buggy. Use mktime instead.
------------------------------
Date: Mon, 14 Jul 1997 09:35:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Spin <spin@cyberlab.nl>
Subject: Re: Can I do that??
Message-Id: <Pine.GSO.3.96.970714093158.19902M-100000@kelly.teleport.com>
On Sun, 13 Jul 1997, Spin wrote (quoting me):
> > Please check out the frequent posting about choosing good subject lines.
> Where can I find 'the frequent posting'?
Please accept my apologies; that frequent posting doesn't seem to be so
frequent any more! I'm not sure why the author discontinued it. In any
case, here it is, below my sig. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
NAME
subject_lines - Choosing Good Subject Lines
DESCRIPTION
The quality of your article's subject line will dictate the
quality of the responses you receive. Choose your subject
lines wisely.
GOOD SUBJECT LINES
These subject lines indicate exactly what the article will
be about and are therefore quality subject lines.
Putting Commas in a number
Can I print "~" (tilde) in a format?
Assigning to an @array and undefined value.
Printing/calling date/time using unix gmtime
How to install individual modules like CGI-Lite?
getpwnam() & Solaris's /etc/shadow file
BAD SUBJECT LINES
These subject lines say nothing about the content in the
article.
Where do I start???!! :-(
How hard would this job be?
Can YOU solve this simple problem?!
Testing.
04]?
Simple split question
These subject lines use negative-flash words. See the
section on NEGATIVE-FLASH WORDS.
Perl newbie with cgi script problem
Newbie needs help
Total Beginner Reqs. Help - Please.
Simple split question
Can YOU solve this simple problem?!
NO SUBJECT LINE
Many of the people who give high-quality responses will tend
to ignore posts which have no subject line at all.
NEGATIVE-FLASH WORDS
The following words are guaranteed to make large numbers of
people deliberately ignore your article. I call these
negative-flash words.
beginner Many people ignore articles which have these words
in their subject lines.
emergency News propagation is too slow. By the time anyone
gets to read it your condition has probably been
upgraded to catastrophic. By the time you get
their response you'll be dead. Don't waste other
people's time with this stuff.
expert See guru.
girl The people who can give you the highest-quality
responses probably aren't in the mood for this
sort of trolling.
guru The truth is that it's probably a non-guru
question. Most gurus will ignore any article that
has this word in its subject line.
help It sounds like you've given up, or, more likely,
haven't tried. Omit this word and the rest of
your subject line will probably be a high-quality
attention-getter.
newbie See beginner.
novice See beginner.
please Don't beg. It's a turn-off.
question It's too obvious, and probably answered in the
manpages or the FAQ.
sex See girl.
simple This word should tell you something--that you need
to look at the manpages a little harder. Don't
waste other people's time with this stuff.
stupid It's just plain derogatory. People don't like to
waste their time on things that are stupid. Hint:
don't tell them it's stupid, and you will get a
higher-quality response.
urgent See emergency.
woman See girl.
NEGATIVE-FLASH EFFECTS
The following effects, like the above list of negative-flash
words, are guaranteed to make large numbers of people
deliberately ignore your article.
ALL CAPITALS
Do not use all capital letters in your subject
line. Many people find the effect annoying or
equate it with newcomers. In either case they
will ignore the posting. Hint: There's nothing
wrong with being a newcomer--we all were at one
time--just don't advertise it.
Multiple bangs!!!!!
Multiple bangs (exclamation points) and multiple
question marks come across as either over-zealous
or literarily ignorant, and both effects tend to
chase away the people who can give the highest-
quality responses.
BAD, BARELY
This brings us to the next category of subject lines: Those
which are bad but could be good with only a slight
adjustment.
HELP: Perl 5.002, SunOS 5.5, gcc 2.7.2, dynamic loading
HELP: Converting text to binary
GRINCH
Dean Roehrich, July 26, 1996.
------------------------------
Date: Mon, 14 Jul 1997 08:56:07 -0700
From: Josh Kostecka <josh@palouse.org>
Subject: could someone look over my code?
Message-Id: <33CA4C17.5D41@palouse.org>
I am having a problem with my search code and I just can't seem to fix
it. When it prints each "hit" page to the list, it is suppose to print
the title of the page. But it only does this some of the time, if any.
So could someone take a look at it. The runable page is at
http://www.econd.org/search/search.html and the code itself is at
http://www.econd.org/search/search.pl.html
Thanks for the help.
Josh Kostecka
------------------------------
Date: Sat, 12 Jul 1997 06:45:21 GMT
From: whborean@sympatico.ca (Wayne and Heather Borean)
Subject: Re: Dear Spammer! We are NOT happy with you.
Message-Id: <33c725ed.8063154@news1.on.sympatico.ca>
On Thu, 10 Jul 1997 17:42:50 -0400, dc@rabi.phys.columbia.edu wrote:
>Please do not spam us again. I hope this request is clear enough for
>you. If not, you might eventually have to suffer flames and bombs, and
>your sysadmins will beat you savagely. I am not making any sort of a
>personal threat, of course, I am merely warning you against provocative
>behaviour.
>Good Day.
>
>>PJ wrote:
>>
>> $50,000.00 for only $5.00 within 2 MONTHS?????
Rather than posting this in the newsgroup, mail it to the postmaster
at the site in questions (farthest right on the path). It works more
often than you'd believe.
Wayne
Maniac at Large - Programmer - Salesman - Forklift Expert
SF Fan - Father - Husband - Gamer
and so many other things I can't remember what they are and
never have time for them anyway...
------------------------------
Date: Mon, 14 Jul 1997 16:11:11 -0400
From: Sysadmin <sysadm@twd.net>
Subject: HELP needed for socket programming
Message-Id: <33CA87DF.5110@twd.net>
This message is a beackon to all perl / programming guru's out there.
I have a small sized favor of coding to ask and I'd rather not reinvent
the wheel, so to speak. I'm writing some code using perl 5.003 so I can
implement a "scrolling" web based chat. I'd like to write a unix side
daemon that will handle all incoming connections, and then display this
data to the appropriate frame. This is really not too technically
difficult, but my only concern is that I need to write a daemon that
does not spawn child processes for every socket that is opened(something
along the lines of innd). The server load would be incredible. I'd
like someway for the server to keep track of the incoming sockets via a
dbm file of some sort and write to them appropriately. I'd appreciate
any and ALL help greatly.
Your's Truely,
sysadm@twd.net
------------------------------
Date: Fri, 11 Jul 1997 22:49:58 -0700
From: perl <guitarweb@hotmail.com>
Subject: Re: Help! Need to run a script!
Message-Id: <33C71B06.4137@hotmail.com>
Joshua Senecal wrote:
>
> I'm new to the PERL scene. I have a PERL script (.pl file) that I need
> to run, but I haven't a clue how. Can anyone help me out?
>
> Please reply by mail.
>
> Thanks!
>
> ---Matt
> msenecal@ucsd.edu
That is way too little info. sorry.. also, depending on your problem,
the system you're running, and more.. it could be a lot.. you didn't say
if you're running it on your own machine, on a server, if you have
permissions on the server.. if perl is set up on the server, or
anything.. needless to say.. you probably don't know, because you are
THAT new to perl. But you need to know at least some of this to have
someone tell you what to do.. you didn't say if you're even tried to run
it, and if so, what errors you're getting.. if it's going to print
something our, or what it's supposed to do. Now You aren't the only one
without a clue.. :-)
Please try looking at the perl web site http://www.perl.com and look at
the FAQ's section, as well as the idiot's guide (simple info on simple
need to know things are there. all in sort of fun of course.. )..
If you know anyone that knows anything about perl, then ask them for
some advice on how to start. or look around.. You see, I don't know
what or how you're trying to do anything, because you only said you
need help getting "a perl script" with a .pl extension to run. Perhaps
your server only allows the .cgi extension?. Is it running at all?..
have you tried? If so, what happens?. what system are you using?. what
is the perl script supposed to do?. what is it?.. Where's my left shoe?.
------------------------------
Date: Mon, 14 Jul 1997 08:49:58 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Satish Gupta <gupta1s@ix.netcom.com>
Subject: Re: Help!: List of Lists; Programming Perl, page 258
Message-Id: <Pine.GSO.3.96.970714084353.19902I-100000@kelly.teleport.com>
On Sun, 13 Jul 1997, Satish Gupta wrote:
> I am trying to learn Perl5 and can't understand the first example given
> on pg 258 of Programming Perl 2nd ed.
For the benefit of those playing along at home (and those lawyers who are
eager to observe copyright infringement :-) here is the text of that
example.
while (<>) {
@tmp = split;
push @LoL, [ @tmp ];
}
> How is this program working? Are we reading the whole file into @tmp,
> with each line being a different element in it?
Let's take a look. The first line reads each line of input, one at a time
(see the docs of the diamond operator for info on where that input comes
from). Each line is placed into $_ in turn.
The second line splits $_ on whitespace, and stores the resultant list
into @tmp.
The third line makes an anonymous list whose elemens are the elements of
@tmp. The reference to that list is then pushed onto @LoL.
So, each line becomes one element of @LoL. Each of those elements is a
reference to a list of zero or more "words" from the corresponding line.
A good way to see what's going on with code like this is to use Perl's
debugger. The command "x \@LoL" (without the quotes, of course) will let
you see a nice display of what's in @LoL.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 14 Jul 1997 09:19:33 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Clay Doxey <cdoxey@erols.com>
Subject: Re: help-print using labels gives error (update)
Message-Id: <Pine.GSO.3.96.970714091533.19902K-100000@kelly.teleport.com>
On Sat, 12 Jul 1997, Clay Doxey wrote:
> I am using Perl Version 5.003 on salaris. I create my scripts at home
> using text editor and FTP to site. When I edit file on site, there are
> ^Ms at the end of each line.
That means that you need to use text mode to upload your text files,
instead of binary mode.
> When I run the following script, I receive "Can't find string terminator
> "VVVVV" anywhere before EOF at test.cgi line 2."
That means that you have something besides VVVVV on the terminator line.
Usually, that's leading or trailing whitespace. In this case, the leftover
DOS characters qualify.
> The question is - I tried " WWW/cM" so it would match VVVVV with ^M,
> but it doesn't work!
I don't see why _that_ could possibly help! :-) But using the proper
transfer mode should make your life easier. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 14 Jul 1997 15:45:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: James Phillips <phillips@nortel.ca>
Subject: Re: How to round numbers in perl
Message-Id: <Pine.GSO.3.96.970714154328.21101G-100000@kelly.teleport.com>
On Mon, 14 Jul 1997, James Phillips wrote:
> Does anyone know how to round numbers in perl?
Only those of us who have met the FAQ. Allow me to introduce you! :-)
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq4/
Does_perl_have_a_round_function_.html
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 11 Jul 1997 21:54:09 -0400
From: David Miller <dm0@avana.net>
Subject: Re: How to substract a uniq integer from a ASCI string
Message-Id: <33C6E3C1.72FE715@avana.net>
This is a multi-part message in MIME format.
--------------3BF9E80A248853C74A5F6291
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
> toutatis@remove.this.toutatis.net (Toutatis) wrote:
>
> Could anybody advise me on how to create from a given string
> an integer that somehow is (quite) unique for that character string?
Here is C code for the well-known CRC-16 function that will give you
a 16-bit integer value.
--------------3BF9E80A248853C74A5F6291
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="crc-16.c"
/*
* CRC-16 computation logic
*
* The logic for this method of calculating the CRC 16 bit polynomial is taken
* from an article by David Schwaderer in the April 1985 issue of PC Tech
* Journal.
*/
static short crctab[] = /* CRC lookup table */
{
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
};
/*
* Update a CRC check on the given buffer.
*/
int
crcbuf(crc, len, buf)
register int crc; /* running CRC value */
register u_int len;
register u_char *buf;
{
register u_int i;
for (i=0; i<len; i++)
crc = ((crc >> 8) & 0xff) ^ crctab[(crc ^ *buf++) & 0xff];
return (crc);
}
--------------3BF9E80A248853C74A5F6291--
------------------------------
Date: 14 Jul 1997 18:49:59 GMT
From: jhd@Radix.Net (Joseph Davidson)
Subject: Implmenting flock
Message-Id: <5qdscn$4ds$1@news1.radix.net>
I have Perl 5.000 on SunOS 5.4 Generic_101945-13. It does not support the
flock function. Do I need a later version of Perl, a re-build or what to
support flock?
Joe Davidson
--
----------------------------------------------------------------------
Joseph Davidson Ph.D.
InterGuru -- Internet Training and Consulting
Technical Web Service, Perl/CGI, E-mail address conversion service
1501 Dublin Drive, Silver Spring, Md. 20902
voice 301 593 4152 ; fax 301 593 2541
jdavidson@interguru.com, http://www.interguru.com
----------------------------------------------------------------------
------------------------------
Date: 14 Jul 1997 13:44:23 -0400
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Re: Is remote registry administration possible for WindowsNT?
Message-Id: <5qdohn$huk$1@auto.med.ohio-state.edu>
I found a good ewbpage about using perl modules with WindowsNt.
http://www.inforoute.cgs.fr/leberre1/main.htm
>I downloaded the latest version of perl for WindowsNT and looked at the
>Win32 module. It has some abilities to change registry locally, but it would
>be cool if it could change it remotely.
--
---------------------------------------------------------------------------
Mark Nielsen men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University
------------------------------
Date: 14 Jul 1997 04:56:07 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: brian@brie.com (Brian Lavender)
Subject: Re: Learning Perl ..Help??
Message-Id: <8czprpn8yw.fsf@gadget.cscaper.com>
>>>>> "Brian" == Brian Lavender <brian@brie.com> writes:
Brian> Randal also writes an excellent Unix Review column you should check
Brian> out. It is at http://www.stonehenge.com/merlyn/UnixReview . Those
Brian> columns are well developed and easy to understand. They have a
Brian> progressive approach to them too.
Thank you for the reference, but the URL is actually written as:
http://www.stonehenge.com/merlyn/UnixReview/
(note the final slash). That makes your web browser and my web server
avoid the additional round trip saying "no, dude, it's over here, not
over there".
Brian> Brie Business Directory - Napa Valley http://www.brie.com/bbd
Heh. Most likely, that's really http://www.brie.com/bbd/ as well, for
the same reasons, unless you really have a *file* named bbd there.
Moral: the trailing slash *is* meaningful. (I wonder how many
millions of redirects are generated in a day because people don't know
this. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 414 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 14 Jul 1997 08:42:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Chuck Mattern <cmattern@madman.ronin.mindspring.com>
Subject: Re: Newbie confusion
Message-Id: <Pine.GSO.3.96.970714082427.19902H-100000@kelly.teleport.com>
On 13 Jul 1997, Chuck Mattern wrote:
> For better or worse I am learning Perl for the Waite Groups Interactive
> book. Lots of good stuff so far but I'm finding some typos and other
> silly problems. The following code does not do what the book says that
> it does:
>
> #!/usr/bin/perl
>
> while (<>) {
> chomp;
> ($verb, $other_words, $noun) = (/\b(\w+)\b\s+\b(.*)\b\s?\b(\w+)\b/o);
> if ($noun) { print "Where is $noun?\n"; }
> else { print "How do I $verb?\n"; }
> }
I wonder what the author of that code thought that the /o modifier adds. I
wonder why they put the second \b in there, among other oddities. I wonder
why they didn't check that the pattern match succeeded. I wonder why they
used <> instead of <STDIN>, and whether they understand the differences.
I wonder why they put parens around the regular expression.
I wonder why they didn't ask somebody like me to check things like this
before publication. I wonder whether you should try to learn from a
different book. :-)
Okay, to be fair, I also wonder whether the book could really be that bad.
Are you sure that that's the _exact_ example from the book?
> The book claims that this will print the parse the line into the
> vairables $verb, $other_wrds and $noun and then if $noun is non-null
> ask the first question, other wise asking the second question.
No, that's not what it does. If the pattern matches, it will ask the first
question (except in the rare case where the "noun" matched is "0").
Otherwise, it asks the second question - even though $verb is likely
undefined in that case.
> All of it works EXCEPT that after the if all three of these variables
> are unset.
No, they should always be set to something. But sometimes they're set to
undef. :-)
> Thus this occurs:
>
> </home/cmattern/src/perl> ./advent
> shut
> How do I ?
Yep, that single word "shut" doesn't match the pattern. That's something
that that code doesn't check for. If you want to fix it, check to see what
defined($verb) is; if that's false, you'll know that the pattern didn't
match. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 14 Jul 1997 08:22:44 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Dave Naden <dnaden@dgs.dgsys.com>
Subject: Re: regexp- capturing matched pattern with an alternation character
Message-Id: <Pine.GSO.3.96.970714081736.19902G-100000@kelly.teleport.com>
On Sun, 13 Jul 1997, Dave Naden wrote:
> Since files may or may not have an extention, the pattern has to allow
> for both possibilities, as in:
>
> /[a-zA-Z0-9]{1,8}\.[a-zA-Z0-9]{1,3}/ # (regular 8.3 format)
>
> /[a-zA-Z0-9]{1,8}(\.[a-zA-Z0-9]{1,3})?/ # (choice of 8 or 8.3 formats)
The second one will match either, so why not simply use that?
> The problem comes when I want to capture the filename with the $& or the
> $1, $2 variables; the second pattern above only gives the easiest match
> (the 8 chars) and then stops before matching the 8.3 even if it's there.
No, it will match the suffix if it can; the quantifier is "grabby". Once
it finds that it can match, it matches as much as it can at that point.
Others will point out that you should avoid $& for efficiency reasons. So,
what I think you want is this, which puts the match into $1.
/([a-zA-Z0-9]{1,8}(?:\.[a-zA-Z0-9]{1,3})?)/
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 14 Jul 1997 13:44:05 +0200
From: Loredana De Dominicis <lory@sesm.it>
Subject: Script CGI to UPLOAD a WEB SERVER
Message-Id: <33CA1105.167E@sesm.it>
I'm trying to write a PERL 4 CGI that permits
to upload a Web Server.
Is it possible to download it from Internet?
Please e-mail me any help you can give, thanks.
~~~~~~~~~~~~~~~~~~~~~
e-mail: lory@sesm.it
~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Mon, 14 Jul 1997 16:09:49 -0400
From: Sysadmin <sysadm@twd.net>
Subject: Socket programming for web based chat server
Message-Id: <33CA878D.17FD@twd.net>
This message is a beackon to all perl / programming guru's out there.
I have a small sized favor of coding to ask and I'd rather not reinvent
the wheel, so to speak. I'm writing some code using perl 5.003 so I can
implement a "scrolling" web based chat. I'd like to write a unix side
daemon that will handle all incoming connections, and then display this
data to the appropriate frame. This is really not too technically
difficult, but my only concern is that I need to write a daemon that
does not spawn child processes for every socket that is opened(something
along the lines of innd). The server load would be incredible. I'd
like someway for the server to keep track of the incoming sockets via a
dbm file of some sort and write to them appropriately. I'd appreciate
any and ALL help greatly.
Your's Truely,
sysadm@twd.net
------------------------------
Date: Mon, 14 Jul 1997 15:02:49 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ryan <rmcguigan@ramresearch.com>
Subject: Re: String Comparison
Message-Id: <Pine.GSO.3.96.970714150050.21101C-100000@kelly.teleport.com>
On 14 Jul 1997, Ryan wrote:
> I would like to be able to compare strings IGNORING CASE.
lc($foo) le lc($bar) # Or some variation on this
> also, what is a good perl book for someone still learning perl. Right
> now I have a really awful book.
The Llama book (documented in perlbook) is good. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 11 Jul 1997 22:57:39 -0700
From: perl <guitarweb@hotmail.com>
Subject: Re: Webmasters???
Message-Id: <33C71CD3.6759@hotmail.com>
Melody Polakow wrote:
>
> I am a fairfly experienced webmaster and may be interested!
> you can see one of my main sites at fairfield.imp.net
>
> On Thu, 10 Jul 1997 23:02:06 -0500, Rishi Bhattacharya
> <rbhattac@jetson.uh.edu> wrote:
>
> >Hello,
> >
> >I am looking for experienced webmasters to join my team in a new project
> >I am starting. The project is www.webresource.net. Please check out the
> >layout at:
> >
> >http://www.webresource.net
> >
> >Remember, it is only a layout. Most links are not functional. It will be
> >a site that will help out novice to expert webmasters. Please contact me
> >at rbhattac@jetson.uh.edu if you have time and are interested. I will
> >not be back to check this newsgroup, so if you are interested, please
> >email me. Thanks.
> >
> >Rishi Bhattacharya
>
> _______________________________
"webmasters"?. HTML?. design? programming? perl?. huh?.
------------------------------
Date: 14 Jul 1997 12:10:19 -0700
From: chrissch@cs.uoregon.edu (Chris Schleicher)
Subject: Re: windows 95 perl
Message-Id: <5qdtir$ea6@psychotix.cs.uoregon.edu>
In article <5qb24u$12ig$1@news.ibm.net.il>,
IBM Israel <addadi@ibm.net.il> wrote:
>Where can I get the window 32/NT/95 version for perl 5?
http://www.activeware.com
--Chris
--
Chris Schleicher Office: 541/346-3998
Univ of Oregon CIS GTF email: chrissch@cs.uoregon.edu
URL: http://www.cs.uoregon.edu/~chrissch/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 734
*************************************