[10014] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3607 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 1 14:06:13 1998

Date: Tue, 1 Sep 98 11:01:31 -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           Tue, 1 Sep 1998     Volume: 8 Number: 3607

Today's topics:
    Re: Tom Phoenix: ANSWERS WANTED! (Albert W. Dorrington)
    Re: Tom Phoenix: ANSWERS WANTED! (Nathan V. Patwardhan)
    Re: Tom Phoenix: ANSWERS WANTED! (Nathan V. Patwardhan)
    Re: Tom Phoenix: ANSWERS WANTED! (Andre L.)
    Re: Tom Phoenix: ANSWERS WANTED! <eashton@bbnplanet.com>
    Re: Tom Phoenix: ANSWERS WANTED! <joneil@cks.ssd.k12.wa.us>
    Re: Tom Phoenix: ANSWERS WANTED! (Nathan V. Patwardhan)
    Re: unlinking file if <= 1 hour <evhendrs@micron.net>
    Re: unlinking file if <= 1 hour (Mike Wescott)
    Re: unlinking file if <= 1 hour (Larry Rosler)
    Re: URGENT: How do I post to a newsgroup from a perl ro <jdporter@min.net>
    Re: URGENT: How do I post to a newsgroup from a perl ro <nguyend7@msu.edu>
    Re: URLencoding to create a clickable URL (Larry Rosler)
        US-NY-LI 516 PERL Programmer/Analyst perlunix@my-dejanews.com
    Re: Using <!--something--> <ktruitt@skypoint.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 1 Sep 1998 10:29:44 -0500
From: awdorrin@mail.delcoelect.com (Albert W. Dorrington)
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <6sh3t8$iku@ws051eng.ictest.delcoelect.com>


In article <JCTG1.30$kE2.226493@news.shore.net>, nvp@shore.net (Nathan V. Patwardhan) writes:
:> Although I appreciate the fact that Tom Phoenix isn't mean to people,
:> I'm sad to admit that I've recognized an ironic trend in his postings.
:> 
:> Over the last year I've read a number of postings like "How do I make
:> 'Perl redirect'?" and Tom's response: "Sounds like this is something
:> related to your browser or server!  You'll need to read the docs and
:> FAQs and all that good stuff.  Hope this helps!"
:> 
:> And there are hundreds of responses like this on clpmisc!  This is way
:> too much with too little content!
:> 
:> Tom, not to ruin your enthusiasm, spit, fire, etc., but I'm afraid
:> that your approach has become ineffective.  What you've ended up doing
:> is adding more noise than would be present if you just ignored folks
:> who are asking FAQs or web questions which are not specifically
:> related to the Perl language.  It's just eerie to read multiple
:> postings from you per day which are almost identical.
:> 

Yeah Tom, shame on you for providing helpful answers/pointers.
You should be providing those 'hey moron don't you know how
to read the manual' posts, which already, far out number
your useful ones.

Tsk, tsk.

-- 
Al Dorrington                                      
FIRMS & Web Admin, Oracle DBA                     Phone: 765-451-9655 
IC-DELCO CIM, Delphi Delco Electronics Systems    Fax:   765-451-8230 


------------------------------

Date: Tue, 01 Sep 1998 16:35:48 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <EnVG1.43$kE2.295335@news.shore.net>

Albert W. Dorrington (awdorrin@mail.delcoelect.com) wrote:

: Yeah Tom, shame on you for providing helpful answers/pointers.

Are you sure that this is what you want?  It may be a mystical problem
or even a psychological one!  But it's certainly not related to Perl!
Hope this helps!

--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>


------------------------------

Date: Tue, 01 Sep 1998 16:38:56 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <AqVG1.44$kE2.295335@news.shore.net>

Elaine -HappyFunBall- Ashton (eashton@bbnplanet.com) wrote:

: i disagree. at least tom doesn't flame them and doesn't hold their hand
: either. sure, you could have mountains of content, but on the simple

This is likely a grammatical problem or even a broken caps lock, but
it's not really related to Perl!  

Hope this helps!

--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>


------------------------------

Date: Tue, 01 Sep 1998 13:03:14 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <alecler-0109981303140001@dialup-690.hip.cam.org>

It is quite unreasonable to demand answers like you do. The man has the
right to respond in the manner he deems appropriate, and that is all.
Besides, he knows what he's doing.

Please, people, let us not personalize the discussions here. It is Not a
Nice Thing to Do(TM).

Andre

====================

In article <JCTG1.30$kE2.226493@news.shore.net>, nvp@shore.net (Nathan V.
Patwardhan) wrote:

> Although I appreciate the fact that Tom Phoenix isn't mean to people,
> I'm sad to admit that I've recognized an ironic trend in his postings.
> 
> Over the last year I've read a number of postings like "How do I make
> 'Perl redirect'?" and Tom's response: "Sounds like this is something
> related to your browser or server!  You'll need to read the docs and
> FAQs and all that good stuff.  Hope this helps!"
> 
> And there are hundreds of responses like this on clpmisc!  This is way
> too much with too little content!
> 
> Tom, not to ruin your enthusiasm, spit, fire, etc., but I'm afraid
> that your approach has become ineffective.  What you've ended up doing
> is adding more noise than would be present if you just ignored folks
> who are asking FAQs or web questions which are not specifically
> related to the Perl language.  It's just eerie to read multiple
> postings from you per day which are almost identical.
> 
> --
> Nate Patwardhan|root@localhost


------------------------------

Date: Tue, 01 Sep 1998 17:27:43 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <35EC2C3C.E8411400@bbnplanet.com>

> This is likely a grammatical problem or even a broken caps lock, but
> it's not really related to Perl!

my lack of capitals is a philosophy, not a hardware problem. certainly
not a perl issue. 

point taken, however, i still fail to see why you are complaining about
a constructive entity on a newsgroup that has a lot of new people who
may, or may not, know what a faq or anything else is. tom is like the
miss manners of clmp politely pointing the gentle readers to the proper
place. 

get over it.

e.


------------------------------

Date: Tue, 01 Sep 1998 10:30:43 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <35EC2F43.2CF97247@cks.ssd.k12.wa.us>

Nathan V. Patwardhan wrote:

> It's just eerie to read multiple
> postings from you per day which are almost identical.

And every one of them a polite pointer to the answers that the person is
looking for.  Tom P is a legitimate Perl Stud and Good Guy in my book,
and I hope he continues as he has in the past for a very long time.

Jerome "Perl Gelding" O'Neil


------------------------------

Date: Tue, 01 Sep 1998 17:42:54 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Tom Phoenix: ANSWERS WANTED!
Message-Id: <ymWG1.47$kE2.329864@news.shore.net>

Elaine -HappyFunBall- Ashton (eashton@bbnplanet.com) wrote:

: point taken, however, i still fail to see why you are complaining about
: a constructive entity on a newsgroup that has a lot of new people who

You might want to reconsider if he's really being constructive --
although he's certainly quite friendly!  After tagging and reading
hundreds (if not thousands) of postings from Tom Phoenix, I gathered
them all into a series of files and ran 'diff' on them, from which I
recognized this:

$ diff rootbeer.*
$

*gasp*

$ grep -ci faq rootbeer.*
10000
$

*gasp*

$ grep -ci browser rootbeer.*
5000
$

*gasp*

: get over it.

Oh, I'm over it.  *plonk*

Cheers!

--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>


------------------------------

Date: Tue, 01 Sep 1998 08:24:04 -0600
From: Ed Henderson <evhendrs@micron.net>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: unlinking file if <= 1 hour
Message-Id: <35EC0384.B033EAAB@micron.net>



Tom Phoenix wrote:

> On Mon, 31 Aug 1998, Ed Henderson wrote:
>
> > If all the files are in a single directory, this will work:
> >
> >   my $expiration_time = 1  # Time in hours;
> >   # $path set to path where target file(s) exist.
> >   unlink grep { (time  - (stat )[9]) > 60*60*$expiration_time } <$path/*>;
>
> No, there's a more subtle bug in that code than the obvious one; it's

This sentence is unclear... what is the obvious bug?

>
> assuming that $path points to the current directory. Since the stat will
> (most often) fail, nearly every file in the given directory will be

Why will stat most often fail? I have actuall tested this code, and stat does
not
fail "most often", however, I do allow that it MAY fail, and in that case will
likely return undef, which will subtract 0 from time, and hence the expression
will evaluate to true, and likely unlink everything (that failed).

So, in light of your (valid) concern, the above could be re-written as:
>   unlink grep { -f and stat and (time  - (stat _ )[9]) >
60*60*$expiration_time } <$path/*>;

Thus grep will return only files for which a valid stat was possible.
Also, it will avoid stating the same file twice, as the second stat has "_" as
the operand
and hence uses the current stat buffer contents. So this is moderately efficient
too!

Note that I also added a -f check, to eliminate an attemp to unlink a
directory!!!
** I never claimed this was complete, just an example of how to accomplish this
type of thing in perl.

Ed Henderson


>
> unlinked. Ouch! Ouch! Stop that!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



------------------------------

Date: 01 Sep 1998 12:48:31 -0400
From: wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott)
Subject: Re: unlinking file if <= 1 hour
Message-Id: <x4lno33hk0.fsf@cygnus.ColumbiaSC.NCR.COM>

In article <MPG.1054a62539832fc998977e@nntp.hpl.hp.com> lr@hpl.hp.com (Larry Rosler) writes:
> It is simpler than that, because the -A -C -M operators give you the time 
> (in days) elapsed since the file was accessed, created-or-inode-changed, 
> or modified.

Not quite. Those operators give the time from last file access (inode change,
modification) 'til the script started. A long running script or a daemon
must take that into account.
-- 
	-Mike Wescott
	 mike.wescott@ColumbiaSC.NCR.COM


------------------------------

Date: Tue, 1 Sep 1998 10:19:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: unlinking file if <= 1 hour
Message-Id: <MPG.1055cc91f2c7ea10989784@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and a copy mailed.]

In article <x4lno33hk0.fsf@cygnus.ColumbiaSC.NCR.COM> on 01 Sep 1998 
12:48:31 -0400, Mike Wescott <wescott@cygnus.ColumbiaSC.NCR.COM> says...
> In article <MPG.1054a62539832fc998977e@nntp.hpl.hp.com> lr@hpl.hp.com (Larry Rosler) writes:
> > It is simpler than that, because the -A -C -M operators give you the time 
> > (in days) elapsed since the file was accessed, created-or-inode-changed, 
> > or modified.
> 
> Not quite. Those operators give the time from last file access (inode change,
> modification) 'til the script started. A long running script or a daemon
> must take that into account.

Quite right.  I write mostly CGI programs, so $^T == time() or maybe 1 
second less. 

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Mon, 31 Aug 1998 12:18:13 -0400
From: John Porter <jdporter@min.net>
Subject: Re: URGENT: How do I post to a newsgroup from a perl routine?
Message-Id: <35EACCC5.C4881B99@min.net>

Mick Knutson wrote:
> 
> URGENT: How do I post to a newsgroup from a perl routine?
> 
> I would like to get a subroutine that will post a message to a news group
> when called.  Is there a subroutine that you can help me with?

"URGENT"?  Huge backlog of spam, huh?

20+ lines of sig, and 4 lines of message.  Sheesh.

-- 
John Porter


------------------------------

Date: 1 Sep 1998 16:03:13 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: URGENT: How do I post to a newsgroup from a perl routine?
Message-Id: <6sh5s1$8jg$1@msunews.cl.msu.edu>

Mick Knutson <NoSpam_mknutson@websolution.com> wrote:
: URGENT: How do I post to a newsgroup from a perl routine?

: I would like to get a subroutine that will post a message to a news group
: when called.  Is there a subroutine that you can help me with?

So why is this so urgent?

-dan

-- 
           Dan Nguyen            | There is only one happiness in
        nguyend7@msu.edu         |   life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 |                   -George Sand



------------------------------

Date: Tue, 1 Sep 1998 09:45:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: URLencoding to create a clickable URL
Message-Id: <MPG.1055c483c3cc4ac0989783@nntp.hpl.hp.com>

In article <slrn6un871.6ii.maurice@we-24-130-48-83.we.mediaone.net> on 
Tue, 01 Sep 1998 07:23:12 GMT, Maurice Aubrey <maurice@hevanet.com> 
says...
> On Tue, 01 Sep 1998 07:15:12 GMT, Richard <passion@freemail.nl> wrote:
> >I know how to decode the URL information to strings that the Perl
> >script can handle. It's something like this:
> >
> >        $value =~ tr/+/ /;
> >        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> >
> >But I can't find the reverse routine. How do I encode information
> >(variables and their value), so I can append it to an URL?
> 
> Sounds like you need the URI::Escape module, available at CPAN.
> 
> http://www.perl.com/CPAN-local/CPAN.html

Modules are useful, but this need is rather trivial.

sub URL_encoded	{	# URL_encoded_string = URL_encoded(string).
    defined(local $_ = shift) or return "";
    s/([" %&+<=>"])/sprintf '%%%.2X' => ord $1/eg;
    $_
}

I put the double-quotes in twice to calm some brain-damaged syntax-
colorers.  The protection against an undefined or nonexistent argument is 
optional.  If you prefer to encode space as '+' instead of '%20', take it 
out of the character class, and add the line:

    tr/ /+/;

Easy, huh?

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Tue, 01 Sep 1998 16:57:56 GMT
From: perlunix@my-dejanews.com
To: g@nettrust.com
Subject: US-NY-LI 516 PERL Programmer/Analyst
Message-Id: <6sh92j$qvs$1@nnrp1.dejanews.com>

http://www.CarFinance.com and http://www.PriceAutoOutlet.com
(a unit of NationsBank) is looking for UNIX PERL programmers.

Requirements: 5+ years professional experience UNIX, Strong PERL.
SQL or Informix a big plus, Java a plus.

Send salary requirements current copy of resume to perlunix@yahoo.com.


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


------------------------------

Date: Tue, 01 Sep 1998 12:43:13 -0500
From: Ken Truitt <ktruitt@skypoint.com>
To: vip <vip@takas.lt>
Subject: Re: Using <!--something-->
Message-Id: <35EC3231.5082@skypoint.com>

vip wrote:
> 
> Hello!!!
> I'm working on a guestbook script. And I have one problem:
> I need the latest posts appear at the top of the page, not at the
> bottom. So
> I need your help now!
> Here is the example of what I want:
> source of file guestbook.html has 100 lines. Line 15 is:
> <!--something-->
> The perl script must open the html file, search for line
> <!--something-->
> and replace it with this:
> -------------begins here---------------
> <!--something-->\n
> <center><h1>Hello!</h1></center><br>\n
> <h3>My name is Joe. I come from USA.</h3><br>\n
> <hr>\n
> -------------ends up here--------------
> So that next time new post would appear instead of the new added
> <!--something-->... I hope you understand what I mean by this? Or do you
> have any other ideas on how to make latest posts appear below the header
> image and text, not at the bottom of page?
>                             Thanks a lot!
>                                                 Vytis.
> 
> Surf Usenet at home, on the road, and by email -- always at Talkway.
> http://www.talkway.com




Ok, if guestbook.html starts something like:

<HTML>\n
<HEAD>\n
<TITLE>This is a test of your coding problem</TITLE>\n
</HEAD>\n
<BODY BGCOLOR="#ffffff">\n
<H1><B><CENTER>CHECK THIS OUT</B></H1>\n
<IMG><SRC="gifs/picture.gif">\n\n

<!--something-->\n

you might be able to use the following code to achieve your purpose:


@newdata=('<!--something-->','<center><h1>Hello!</h1></center><br>\n',
'<h3>My name is Joe. I come from USA.</h3><br>\n',
'<hr>\n');

open(SOURCE,"guestbook.html");       #open the file for reading only
@guestb=<SOURCE>;                    #put each line in an element of 
for ($i=0;$i<=$#guestb;$i++) {       #@guestb; read through each line of
 $line=$guestb[$i];                  #the array with a for-loop until
 chop $line;  
 if ($line eq '<!--something-->\n') {#if the line matches '<!-something-
 splice(@guestb,$i,1,@newdata);      #use SPLICE to replace it with
 $i=$#guestb;                        #set $i to exit condition
 }										                         
}										                          
                                   
close(SOURCE);						  #close SOURCE for reading

open(SOURCE,">guestbook.html");     #open SOURCE for writing
for ($i=0;$i<=$#guestb;$i++) {      #print it line by line from @guestb
 print SOURCE $guestb[$i];          
}
close(SOURCE);						  #close SOURCE.

------------------------------------

It sounds like you were trying to do this by opening guestbook.html for
*appending* (ie open(SOURCE,">>guestbook.html");).  This will only put
appended material on the bottom of the file.  If you want to make any
other change to a file, you must completely overwrite it.

If splice confuses you, or if I set length wrong ;), see the appropriate
documentation for that command--it's quite useful.

Ken Truitt


------------------------------

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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 3607
**************************************

home help back first fref pref prev next nref lref last post