[10863] in Perl-Users-Digest
Perl-Users Digest, Issue: 4464 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 19 23:07:29 1998
Date: Sat, 19 Dec 98 20:00:13 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 19 Dec 1998 Volume: 8 Number: 4464
Today's topics:
Re: Generating Random Hexadecimal Numbers (Alan Barclay)
How do I create a password protected web site stan232@yahoo.com
More: Re: Error when trying to use flock() example from <richgrise@entheosengineering.com>
Re: Perl Training - Worth it? <tchrist@mox.perl.com>
Re: reading all files in a directory--Ok here is sample <richgrise@entheosengineering.com>
Re: reading form files <richgrise@entheosengineering.com>
Re: Retrospective on comp.lang.perl.moderated? (Erland Sommarskog)
Stop Timing Out? (Mike Watkins)
Re: Stop Timing Out? (Maurice Aubrey)
Re: Why Is Perl not a Language? <tchrist@mox.perl.com>
Re: Why Is Perl not a Language? <flavell@mail.cern.ch>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Dec 1998 00:48:32 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: Generating Random Hexadecimal Numbers
Message-Id: <914114895.535141@elaine.drink.com>
In article <comdog-ya02408000R1812981454080001@news.panix.com>,
brian d foy <comdog@computerdog.com> wrote:
>In article <367AA836.367E44BB@cisco.com>, Tom Lynch <tlynch@cisco.com> posted:
>> on a boundry. The problem is generating
>> hex numbers from 0 to 1FFFFFFF even incrementing
>> by 4 takes a loooong time. Then the file is
>> huge.
>
>why not generate a random number as usual, round off to the
>nearest boundry, then convert to hex with sprintf or the like?
If you want to generate random numbers by 4's, then it's
easier to generate a random number as usual, multiply by 4,
then convert to hex. Rounding to boundaries is messy.
------------------------------
Date: Sun, 20 Dec 1998 03:39:37 GMT
From: stan232@yahoo.com
Subject: How do I create a password protected web site
Message-Id: <75hrhp$6fi$1@nnrp1.dejanews.com>
please email me
short stories
www.freeyellow.com/members2/kkkkkk
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 19 Dec 1998 18:59:09 +0000
From: Rich Grise <richgrise@entheosengineering.com>
Subject: More: Re: Error when trying to use flock() example from perlfaq5
Message-Id: <367BF77D.56BF4FA8@entheosengineering.com>
Rich Grise wrote:
>
> truncate(FH, 0)
> or die "can't truncate numfile: $!";
>
> But howcome the code snippet right out of the faq fails?
>
> perl, version 5.004_03
> Slackware Linux 3.3.0, kernel 2.0.30,
> Server version Apache/1.2.0.
>
> TIA :)
There's more: I've done some experiments with this truncate() call,
and always get an error there. I get "permission denied" on my home
Linux system, and after reading perlfunc truncate, thought, "Hmmm.."
uploaded it to my website host, who has
BSDI BSD/OS 2.1 Kernel #19:
and get:
Invalid argument at ./trunctest.pl line 30.
Does this mean that `truncate()' isn't implemented? If that's
the case, how can I safely lock and update the file? Fall back
on the file.lock method? Is there another way to truncate it?
Would it be safe to
open (FH, "+<numfile") || die $!;
lock (FH, LOCK_EX) || die $!;
$num = chomp (<FH>) || die $!;
seek (FH, 0, 0) || die $!;
$num++;
print FH, $num || die $!;
close (FH) || die $!;
because the updated number will be the same size as or one digit
longer than the previous one?
(... goes and writes another snippet ...)
Yeah. In-place overwrite. Should work for the main index.html
update too, since it always grows, right?
Never mind. Thank you for your patience.
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)
------------------------------
Date: 20 Dec 1998 00:59:05 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Training - Worth it?
Message-Id: <75hi4p$js9$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Chris Hobbs <chobbs@silvervalley.k12.ca.us> writes:
:So my question is, "Has anyone attended these courses?" It's $1095 for
:each, and while I could get the boss to pay for it, I could also buy the
:enrite zoo of O'Reilly books and save my employer several hundred
:dollars.
My goodness, but that's expensive! You can do a lot better than that
if you look around just a wee bit. I'd rather not say more than that.
--tom
--
If I don't document something, it's usually either for a good reason,
or a bad reason. In this case it's a good reason. :-)
--Larry Wall in <1992Jan17.005405.16806@netlabs.com>
------------------------------
Date: Sat, 19 Dec 1998 19:34:32 +0000
From: Rich Grise <richgrise@entheosengineering.com>
To: Tony <tspencer@exconet.co.uk>
Subject: Re: reading all files in a directory--Ok here is sample code.
Message-Id: <367BFFC7.18C5211C@entheosengineering.com>
Tony wrote:
>
> Ok
> Here is a sample of code I am currently using to read data from one users
> file...
[much code snipped]
> I was looking also into use something like
>
> foreach $userfile ("userdata[0]","userdata[3]") {
> print "$userfile Name: userdata[0] Email : userdata[3] \n";
> }
[...]
> Thanks for any help
> Tony
How about:
#!/usr/bin/perl -w
$userdir = '/realuserdir';
opendir (USERDIR, "$userdir") or die $!;
@USERDIR = <USERDIR> or die $!;
closedir USERDIR or die $!;
foreach $userfile (@USERDIR) {
chomp $userfile;
if ($userfile =~ m/^\./) { next; } # this will skip over ., .., and
hidden files
# (I learned the hard way that I need to do that!)
open (USERFILE, "<$userdir/$userfile") or die $!;
# do stuff to USERFILE
close (USERFILE) or die $!;
}
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)
------------------------------
Date: Sat, 19 Dec 1998 19:38:49 +0000
From: Rich Grise <richgrise@entheosengineering.com>
To: Martin Schager <martin.schager@vienna.at>
Subject: Re: reading form files
Message-Id: <367C00C9.572E908B@entheosengineering.com>
Martin Schager wrote:
>
> Hi I!
>
> I have the following problem:
>
> $fi_content = <FIL>;
That line only reads one line of the file, into the scalar, $fi_content.
> How do I read the entire file into a variable by keeping the line format
> (paragraphs,[\n's ,\t, s ], etc)
>
> Thanks
>
> MS
You want to do this:
@FI_CONTENT = <FIL>;
then each element of @FI_CONTENT will contain one line of the file, and
will keep the newline at the end and everything.
Please see perldat (I think that's it.)
--
Rich Grise
richgrise@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)
------------------------------
Date: Sat, 19 Dec 1998 21:56:07 GMT
From: sommar@algonet.se (Erland Sommarskog)
Subject: Re: Retrospective on comp.lang.perl.moderated?
Message-Id: <75h7dn$9u7$1@cubacola.tninet.se>
lr@hpl.hp.com (Larry Rosler) skriver:
>With year-end-assessment time rapidly approaching, would anyone care to
>comment on how comp.lang.perl.moderated has performed over its life of
>six months or so, relative to the hopes and expectations of its
>proponents?
As others I am somewhat surprised of the low volume. I would have
expected a little more. Then again, I would never dream of subscribing to
comp.lang.perl.misc, because of the high volume there.
And when it comes to contents, I have to say that I am very satisfied.
I also follow a few Perl-Win32 lists, and the questions that appear
there are the same newbie stuff all the time. Usually people don't
even know which list to post to. (There is a Perl-Win32-Web list, a
Perl-Win32-Database list as well as a general Perl-Win32-Users, but
sometimes you would believe that if you follow the general list only.)
On these lists I browse the digests quickly to see if there is some
interesting topic. On comp.lang.perl.moderated I read most of the
articles, because I actually find something to learn.
--
Erland Sommarskog, Stockholm, sommar@algonet.se
This could have been my two cents worth, but alas the Swedish
government has decided that I am not to have any cents.
------------------------------
Date: Sun, 20 Dec 1998 01:45:05 GMT
From: mwatkins@3dmail.com (Mike Watkins)
Subject: Stop Timing Out?
Message-Id: <367c55bf.34186371@news.compuserve.com>
Hi there,
I've created a script which contains a large member database. One of
the options of this script is the ability to automatically send all
members in that database a personalized e-mail. The feature works
fine, except for that the script keeps timing out when it tries to
send over 200 messages.
This function is all in the same subroutine. What happens, is it
goes through the database member by member, and goes through the
message line by line filling in the merge fields with the member's
personal info as it goes. It uses sendmail -t to send all messages.
I was wondering, is there anyway to have this feature stop timing out
before all messages are sent.
Any help would be much appreciated.
Mike Waktins
mailto:mwatkins@3dmail.com
------------------------------
Date: Sun, 20 Dec 1998 02:46:13 GMT
From: maurice@hevanet.com (Maurice Aubrey)
Subject: Re: Stop Timing Out?
Message-Id: <slrn77op7m.mss.maurice@we-24-130-58-139.we.mediaone.net>
On Sun, 20 Dec 1998 01:45:05 GMT, Mike Watkins <mwatkins@3dmail.com> wrote:
>I've created a script which contains a large member database. One of
>the options of this script is the ability to automatically send all
>members in that database a personalized e-mail. The feature works
>fine, except for that the script keeps timing out when it tries to
>send over 200 messages.
>
>This function is all in the same subroutine. What happens, is it
>goes through the database member by member, and goes through the
>message line by line filling in the merge fields with the member's
>personal info as it goes. It uses sendmail -t to send all messages.
>
>I was wondering, is there anyway to have this feature stop timing out
>before all messages are sent.
http://www.stonehenge.com/merlyn/WebTechniques/col20.html
- Maurice
------------------------------
Date: 20 Dec 1998 00:56:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why Is Perl not a Language?
Message-Id: <75hi0g$js9$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, vitus@brass.fe.msk.ru (Victor B Wagner) writes:
:I see you misunderstand concept of scripting language.
:Read J Ousterhout article on scripting
John's article is slightly confused. And if you talk to him directly,
you'll see that it isn't all so clear. You'd better read my response
as well.
:Perl is scripting rather than language not becouse you cannot program on
:it, but becouse you can script on it.
What a self-referential defintion. That's logically indefensible.
The fact of the matter is that there is no difference whatsoever,
and you've merely fallen prey to marketing hype.
--tom
--
MS-DOS is CP/M on steroids, bigger bulkier and not much better.
Windows is MS-DOS with a bad copy of a Macintosh GUI.
NT is a Windows riddled with VMS.
------------------------------
Date: Sun, 20 Dec 1998 02:18:54 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Why Is Perl not a Language?
Message-Id: <Pine.HPP.3.95a.981220020545.1316A-100000@hpplus01.cern.ch>
On 16 Dec 1998, Victor B Wagner wrote:
> Perl is scripting rather than language not becouse you cannot program on
> it, but becouse you can script on it.
That's not an explanation. It's nothing more than a restatement of the
(inaccurate) premise.
> Scripting is just much more powerful concept than programming.
> In programming, when you need to do something with script, you have
> to scan it character by character, writing some FSA or LALR parser.
> In scripting you just use built-in regexp feature.
Ah, so a C program that calls a regexp library suddenly isn't
"programming" any more, in your terms? Unhelpful.
> Scripting is something which allows you to build useful tools
And in "scripting" (of the kind we're discussing here) you can "just"
write a program.
>from large
> and flexible blocks with few dozens lines of code.
So what's new? Programming started with writing out the bytes of
machine language, and then developed into higher and higher level
languages.
> Of course you pay
> with runtime efficiency,
This isn't obvious. In fact I've seen some dramatic counter-examples.
But really it doesn't help to throw any light on your original
assertion.
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4464
**************************************