[13758] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1168 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 24 18:05:38 1999

Date: Sun, 24 Oct 1999 15:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940802708-v9-i1168@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 24 Oct 1999     Volume: 9 Number: 1168

Today's topics:
    Re: _Please_ improve localtime! (Ilya Zakharevich)
        can a perl script do this? <deplib@citytel.net>
    Re: Expr or block as 1st param: Compiler magic needed? <jon@midnightbeach.com>
    Re: file sorting <spyder@pikesville.net>
    Re: file sorting <spyder@pikesville.net>
    Re: file sorting <gellyfish@gellyfish.com>
    Re: How to pick a random item from an array? <gellyfish@gellyfish.com>
    Re: invalid transmission? <smt@bpsinet.com>
    Re: Is it the list or the re? <gellyfish@gellyfish.com>
        Learn to do deja searches was [Re: Perl vs. REBOL] <ltl@rgsun5.viasystems.com>
    Re: Learn to do deja searches was [Re: Perl vs. REBOL] <jtsai@virginia.edu>
    Re: linux perl editor? <dan@tuatha.sidhe.org>
    Re: linux perl editor? <carville@cpl.net>
    Re: Long menus -- any solutions? <stacy.doss@amd.com>
    Re: New short cut assignment operators? <rick.delaney@home.com>
    Re: Oh god! Not another Net::ftp question! (Kenneth Herron)
    Re: Perl Message Board problem <flavell@mail.cern.ch>
    Re: Perl Message Board problem <ebow2000NOebSPAM@aol.com.invalid>
    Re: Perl Message Board problem <rick.delaney@home.com>
    Re: Perl vs. REBOL <gellyfish@gellyfish.com>
        Piggyback parameters on CGI script URL? Or... ? (Ben Blish)
        Problems with files <christian@wix.dk>
    Re: Problems with files <marcel.grunauer@lovely.net>
    Re: removing newlines from a string. (RDusemund)
    Re: removing newlines from a string. (Gordon Clemmons)
    Re: replacing special characters to %xx for browsers <gellyfish@gellyfish.com>
    Re: Security on the web with Perl <gellyfish@gellyfish.com>
        TokenParser <hxshxs@my-deja.com>
    Re: Web based email program <gellyfish@gellyfish.com>
        write binary? <bob>
    Re: write binary? <marcel.grunauer@lovely.net>
    Re: write binary? <flavell@mail.cern.ch>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 24 Oct 1999 19:07:54 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: _Please_ improve localtime!
Message-Id: <7uvlea$rn0$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Russell Schulz 
<Russell_Schulz@locutus.ofB.ORG>],
who wrote in article <19991023.213104.5V6.rnr.w164w@locutus.ofB.ORG>:
> > And they're not really the problem; it's all that screwed-up code that
> > is already written and will break in the year 2000 or before.
> 
> I disagree; I think there's enough code being written incorrectly even
> today that it would have been worthwhile; I think the sooner the change
> is/had been made the better.

Read my lips: there will be no change in the approaching 2 years.

If all the smart alecs who understand this issue now gave their voices
15 (or maybe even 8) years ago, the situation might be well
different.

[I do not think Larry made this stupid decision of AD-1900
 consciously, probably he just mindlessly inherited brain-dead C
 decision.  And I think he would be glad to change things if pointed in
 a correct direction sufficiently long ago.]

Let me give you *one* datapoint.  The smart alec *me* understood the
significance of the human factor in localtime() debate only a year
(max two) ago.

Ilya

P.S.  In 2 years the situation may change: it would be 2 years as the
      answer given by localtime() carries *no* convinience at all.  ;-)


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

Date: Sun, 24 Oct 1999 14:57:43 -0700
From: "Joe Zelwietro" <deplib@citytel.net>
Subject: can a perl script do this?
Message-Id: <3813820e@rsl2.rslnet.net>

Hello All:

I know that what I'm asking is a client-side issue and perl works on the
server-side, but I need to know whether Perl can do what I need before I
look elsewhere.
I want a browser to have a home page, call it Bob's webpage.  After people
have surfed a few minutes (say 3 minutes)  and left the machine I want the
browser to revert back to Bob's page.  Is this possible in Perl?  All advice
welcome.

Joe Zelwietro




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

Date: Sun, 24 Oct 1999 13:57:53 -0700
From: Jon Shemitz <jon@midnightbeach.com>
Subject: Re: Expr or block as 1st param: Compiler magic needed?
Message-Id: <381372D1.9E2DE6B@midnightbeach.com>

Larry Rosler wrote:

> > I know that that's the effect - but is that what 'really' happens?
> > Reverse engineering, I assume that there is only one grep primitive,
> > which always returns a list, and the scalar context pretty much comes
> > down to slapping an implicit "scalar" in front of the grep, to get the
> > list length.
> 
> Benchmark: timing 1024 iterations of Array, List, Scalar...
>      Array: 46 wallclock secs (44.89 usr +  1.06 sys = 45.95 CPU)
>       List: 44 wallclock secs (43.19 usr +  1.00 sys = 44.19 CPU)
>     Scalar: 23 wallclock secs (23.16 usr +  0.00 sys = 23.16 CPU)
> 
> So scalar grep indeed does less work than list grep.  Some feel strongly
> that the same sort of optimization should be applied to map in void
> context (not to generate the result list at all), but that hasn't
> happened yet.

Thanks, again. While collecting tomatoes for dinner Friday night - too
close to having to hop into the car and drive to some friends' to
investigate or post a retraction - I realized that my gedanken reverse
engineering was flawed, anyway. Even assuming that there is only one
copy of the grep array scaning code, it would undoubtedly make more
sense to pass it a simple two-state parameter - array or scalar context?
- which would control how it would handle matches. In the scalar
context, it would just increment the result counter; in the array
context, it would malloc, append, and all that.

> So scalar grep indeed does less work than list grep.  Some feel strongly 
> that the same sort of optimization should be applied to map in void 
> context (not to generate the result list at all), but that hasn't 
> happened yet.

I thought about that when I found myself using map in a void context -
but realized that foreach has the same effect, without the side effect
of creating and discarding an unwanted result. I suppose I could work up
some enthusiasm over the notion that the compiler should turn a void map
call into a foreach, but not enough to dig into the source and try it.
;-)

-- 

http://www.midnightbeach.com    - Me, my work, my writing, and
http://www.midnightbeach.com/hs - my homeschool resource pages


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

Date: Sun, 24 Oct 1999 15:37:08 -0400
From: "V.B." <spyder@pikesville.net>
Subject: Re: file sorting
Message-Id: <38135FE4.4AD2F1A9@pikesville.net>

HA! Thanks


Jonathan Stowe wrote:

> On Sat, 23 Oct 1999 08:51:31 -0700 Larry Rosler wrote:
> > In article <7us8u8$eh7$1@gellyfish.btinternet.com> on 23 Oct 1999
> > 12:16:08 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
> > + On Fri, 22 Oct 1999 21:41:51 -0400 Bob Walton wrote:
> > + > "V.B." wrote:
> > + > ...
> > + >> i have a file,,, myfile.ext, it contains multiple single line
> > + >> entries, each entry contains 7 ";" delimited values,,, id like to
> > + >> sort the file by the 5th value of each entry,,,. if read the sort
> > + >> faq and perlman , but it only confused me ,,, if anyone
> > + >> can point me in the direction of a good example, id be overjoyed!
> > + > ...
> > + > Try:
> > + >
> > + > open IN,"myfile.ext" or die "Oops, open trouble, $!\n";
> > + > print for(sort {(split /;/,$a)[4] cmp (split /;/,$b)[4]} <IN>);
> > + > close IN or die "Oops, close trouble, $!\n";
> > +
> > + There is that of course but for a larger file the overhead of calling
> > + the splits in the comparison sub is going to drive the execution
> > + time of this way up :
> > +
> > + print for ( map   { $_->[1] }
> > +             sort  { $a->[0] cmp $b->[0] }
> > +             map   { [(split /;/)[4],$_ ] }
> > +             <IN> );
> >
> > Well, I've hung back watching you guys develop the sorting algorithm,
> > probably past the needs of this poster (who said he couldn't grok the
> > FAQ).  But now that the Schwartz has appeared, I might as well show
> > everyone else a GRP (Guttman-Rosler Packed) sort also.  For the ultimate
> > in performance at a reasonable price:
> >
> >   print # for??? -- 'print' can handle the list directly!
> >       map  substr($_, 1 + rindex $_, "\0") =>
> >       sort
> >       map  +(split /;/)[4] . "\0$_" =>
> >       <IN>;
> >
> > <URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>
> >
>
> The price is of course that you have to buy into Larry's thing about the
> => ;-}
>
> I'd forgot the URL Larry - I'll remember it next time ;-}
>
> /J\
> --
> Jonathan Stowe <jns@gellyfish.com>
> <http://www.gellyfish.com>
> Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>



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

Date: Sun, 24 Oct 1999 15:40:55 -0400
From: "V.B." <spyder@pikesville.net>
Subject: Re: file sorting
Message-Id: <381360C7.3B6F25FF@pikesville.net>

in your example , you state that print can handle the list directly... what
i
am looking for is the myfile.ext to be sorted itself,,, back into the
file....
the faq example , after i tried it, did the job,,, will your GRP example do
the same? or will it orint directly to an html?  Im going to go play with it
for a bit.
ThankYou
Vince

"V.B." wrote:

> ThankYou for your response.  I do appreciate it. I had viewed your page
> before, yet was still wondering about a few things. I had even seen that
> same example..but, now that i look at it from a different point of, things

> seem to be making a little more sense..
> All Is Appreciated
> The mind is but a crevice, waiting to become a mountain.
>
> Larry Rosler wrote:
>
> > In article <7us8u8$eh7$1@gellyfish.btinternet.com> on 23 Oct 1999
> > 12:16:08 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
> > + On Fri, 22 Oct 1999 21:41:51 -0400 Bob Walton wrote:
> > + > "V.B." wrote:
> > + > ...
> > + >> i have a file,,, myfile.ext, it contains multiple single line
> > + >> entries, each entry contains 7 ";" delimited values,,, id like to
> > + >> sort the file by the 5th value of each entry,,,. if read the sort
> > + >> faq and perlman , but it only confused me ,,, if anyone
> > + >> can point me in the direction of a good example, id be overjoyed!
> > + > ...
> > + > Try:
> > + >
> > + > open IN,"myfile.ext" or die "Oops, open trouble, $!\n";
> > + > print for(sort {(split /;/,$a)[4] cmp (split /;/,$b)[4]} <IN>);
> > + > close IN or die "Oops, close trouble, $!\n";
> > +
> > + There is that of course but for a larger file the overhead of calling
> > + the splits in the comparison sub is going to drive the execution
> > + time of this way up :
> > +
> > + print for ( map   { $_->[1] }
> > +             sort  { $a->[0] cmp $b->[0] }
> > +             map   { [(split /;/)[4],$_ ] }
> > +             <IN> );
> >
> > Well, I've hung back watching you guys develop the sorting algorithm,
> > probably past the needs of this poster (who said he couldn't grok the
> > FAQ).  But now that the Schwartz has appeared, I might as well show
> > everyone else a GRP (Guttman-Rosler Packed) sort also.  For the ultimate

> > in performance at a reasonable price:
> >
> >   print # for??? -- 'print' can handle the list directly!
> >       map  substr($_, 1 + rindex $_, "\0") =>
> >       sort
> >       map  +(split /;/)[4] . "\0$_" =>
> >       <IN>;
> >
> > <URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>
> >
> > --
> > (Just Another Larry) Rosler
> > Hewlett-Packard Laboratories
> > http://www.hpl.hp.com/personal/Larry_Rosler/
> > lr@hpl.hp.com






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

Date: 24 Oct 1999 11:11:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: file sorting
Message-Id: <7uuphp$g11$1@gellyfish.btinternet.com>

On Sat, 23 Oct 1999 08:51:31 -0700 Larry Rosler wrote:
>        But now that the Schwartz has appeared, 
> 

After I read that I got this picture in my mind :

'Release the Schwartz' [cue music]

Randal in chains and leather is dragged out of a large trunk ...

I guess we could call it Perl Fiction ;-}

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 24 Oct 1999 21:37:50 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to pick a random item from an array?
Message-Id: <7uvu7e$gjv$1@gellyfish.btinternet.com>

On Sun, 24 Oct 1999 13:24:44 GMT AcCeSsDeNiEd wrote:
> 
>       a code                                                 
>

What does this mean ? This reeks of script kiddie of k3wl t0k of all
those things that make *this programmer* want to go out an start tending
sheep ...

You have *some code* or you have *a program* - *a code* will generally have
nothing to do with computer programming in any particular sense.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 24 Oct 1999 14:41:40 -0500
From: "Steve" <smt@bpsinet.com>
Subject: Re: invalid transmission?
Message-Id: <BhJQ3.1919$SU1.175511@news1.primary.net>

why do people have to be so damn rude...all it is is a question that has not
been answered by the host server. If you are the expert on this subject then
you should know if it is a perl question and not just reply that it doesn't
"sound" like one.  Newsgroups are supposed to be helpful to people not for
people to be ridiculed! It is a legitimate question and all I would like to
know is if anyone has ever run into this problem before. I did not expect to
be ridiculed for asking a question! There are several "programmers" out
there who use this script and I thought some of them might be courteous
enough to tell me if they have ever ran into this error. I will venture to
guess that you are just some errogant asshole who likes to make people think
he is an expert! I really hope there is a respectful web master out there
who might be able to at least point me in the right direction to correct
this problem.




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

Date: 24 Oct 1999 21:47:07 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is it the list or the re?
Message-Id: <7uvuor$gk9$1@gellyfish.btinternet.com>

On Sun, 24 Oct 1999 02:45:15 GMT Andy Smith wrote:
>
>            this part was taken from a chunk of another script. I have
> no clue who wrote it, 
> 

I'm sorry then you deserve everything that is coming to you - as a
programmer it is your responsibility to understand what it is you are
causing to happen in your program.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 24 Oct 1999 19:16:46 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Learn to do deja searches was [Re: Perl vs. REBOL]
Message-Id: <7uvluu$8hv$1@rguxd.viasystems.com>

Did you guys even bother to search the newsgroup archives on
http://deja.com/?  I suspect you are somewhat ignorant about usenet.
If you had done even a rudimentary bit of homework you would not have
been surprised by the responses you got.

If you do not know how to do a search on deja, look at their
FAQs.  Hint:  Use "power search" with newsgroup comp.lang.perl.misc
and subject *REBOL*.

If after doing your homework you are confused about a specific point
about the Perl language, come back and discuss the specific concept.
If you want to talk about REBOL, go to a newsgroup where REBOL is
discussed.

You may be able to get constructive dialogue about the relative
strengths of Perl vs. another language on c.l.p.m, but not by asking
the kind of open-ended question you asked.  (Reference: Search for
posts by Abigail in c.l.p.m with subject containing Python.) Narrow
the topic to a specific point. Then make an assertion supported by
the facts as you see them.  You may still get slammed for it, but the
slamming is more likely to contain logical arguments that refute or
support your assertion.

Please do not whine about the constructive advice you have been given
here.  That would be as bad as if your offensive lineman whined about
how Corey Moore wasn't as good as he was hyped to be after getting
their butts whipped.  Oh Wait.  They did do that, didn't they.  What
a curious fantasy you live there at UVA.  :-)
Go Hokies!

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: Sun, 24 Oct 1999 17:05:41 -0400
From: James Tsai <jtsai@virginia.edu>
Subject: Re: Learn to do deja searches was [Re: Perl vs. REBOL]
Message-Id: <381374A5.F994EF52@virginia.edu>

Point taken.  However, the responses by most clpm-ers were in no way
"constructive."  I just came in looking for a different perspective on a
relatively new language.  If I posted to the wrong group (and apparently I
have), then so be it.  My fault.  There's no need to bring extranenous
matters into the equation.  It would have been much simpler if someone had
just replied "sorry, we don't address questions like that here."

In terms of football, I'm not a big enough fan to even respond to a Wahoo
- Hokie rivalry.  So, go Hokies!  UVa football sucks anyway.

Billy Zhao

lt lindley wrote:

> Did you guys even bother to search the newsgroup archives on
> http://deja.com/?  I suspect you are somewhat ignorant about usenet.
> If you had done even a rudimentary bit of homework you would not have
> been surprised by the responses you got.
>
> If you do not know how to do a search on deja, look at their
> FAQs.  Hint:  Use "power search" with newsgroup comp.lang.perl.misc
> and subject *REBOL*.
>
> If after doing your homework you are confused about a specific point
> about the Perl language, come back and discuss the specific concept.
> If you want to talk about REBOL, go to a newsgroup where REBOL is
> discussed.
>
> You may be able to get constructive dialogue about the relative
> strengths of Perl vs. another language on c.l.p.m, but not by asking
> the kind of open-ended question you asked.  (Reference: Search for
> posts by Abigail in c.l.p.m with subject containing Python.) Narrow
> the topic to a specific point. Then make an assertion supported by
> the facts as you see them.  You may still get slammed for it, but the
> slamming is more likely to contain logical arguments that refute or
> support your assertion.
>
> Please do not whine about the constructive advice you have been given
> here.  That would be as bad as if your offensive lineman whined about
> how Corey Moore wasn't as good as he was hyped to be after getting
> their butts whipped.  Oh Wait.  They did do that, didn't they.  What
> a curious fantasy you live there at UVA.  :-)
> Go Hokies!
>
> --
> // Lee.Lindley   /// I used to think that being right was everything.
> // @bigfoot.com  ///  Then I matured into the realization that getting
> ////////////////////   along was more important.  Except on usenet.



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

Date: Sun, 24 Oct 1999 19:32:41 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: linux perl editor?
Message-Id: <t9JQ3.765$cP2.3861@news.rdc1.ct.home.com>

Abigail <abigail@delanet.com> wrote:
> Elaine -HFB- Ashton (elaine@chaos.wustl.edu) wrote on MMCCXLI September
> MCMXCIII in <URL:news:380DDDB5.647B3D86@chaos.wustl.edu>:
> `` Kent Perrier wrote:
> `` > I like echo.
> `` 
> `` Real men use ed :)

> Pfff. ed is for wussies. Real (wo)men toggle front panels.

Hah! Wimp. Real Programmers use a nail and 9-volt battery to set the
magnetic fields on the cores in the memory chassis.

					Dan


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

Date: Sun, 24 Oct 1999 22:04:38 +0000
From: Stephen Carville <carville@cpl.net>
Subject: Re: linux perl editor?
Message-Id: <38138276.843B8FCB@cpl.net>

"Marc H. Robards" wrote:
> 
> Anyone have any recommendations for a perl editor under Linux?  Or is emacs
> or vim the way to go?  I've just started using Linux, so any suggesstions
> would be appreciated.

I've found kwrite to be very nice.  Next to that I like Xemacs.  Both
have syntax highlighting but kwrite doesn't do the brace matching like
Xemacs.

-- 
Stephen Carville
carville@cpl.net
----------------------------------------------------
There are two kinds of people: those who do the work and those
who take the credit. Try to be in the first group; there is less      
competition there. 
                                        Indira Gandhi


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

Date: Sun, 24 Oct 1999 16:33:47 -0500
From: Stacy Doss <stacy.doss@amd.com>
Subject: Re: Long menus -- any solutions?
Message-Id: <38137B3B.122C1747@amd.com>

Makarand Kulkarni wrote:
> 
> Stacy Doss wrote:
> 
> > Is there any way to have a menu widget display in multiple columns?
> 
> assuming that you are talking about menu widgets in the inside
> HTML forms -- you cannot change their default behaviour.
> In netscape I have seen that a drop list (created using popup_menu() 

Actually I'm refering to the Tk Menu widget.

-- 


  _______           : Stacy Doss
  \____  | Advanced : Product Development Engineering
  /|   | | Micro    : Stacy.Doss@amd.com
 | |___| | Devices  : Voice: (512) 602-2324
 |____/ \|          : FAX:   (512) 602-6970
                    : Wats Line: 1-800-538-8450 x52324


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

Date: Sun, 24 Oct 1999 19:41:58 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: New short cut assignment operators?
Message-Id: <38136117.4083D64E@home.com>

[posted & mailed]

Craig Berry wrote:
> 
> Okay, Perl gurus, can someone please give me the skinny on Benchmark?  
> I used to use coderefs, until Ilya dressed me down for it, saying 
> coderefs would never give good results.  Now Abigail is telling me 
> that string evals are bad.  What's up with this?  Which is The True 
> Way of Benchmark (tm)?

Well, string evals would be bad if they were done for each iteration but
you don't have to be a guru to look at the code in Benchmark.pm to see
that that ain't so.

Code refs are really only bad when the overhead of calling the sub is of
a similar (or greater) magnitude to that of the execution time of the
code inside the sub (which is often for the one line benchmarks that we
usually see).

If the overhead of the sub call does not swamp the code it contains then
it is possible to get a greater/less than result in a reasonable number
of iterations.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 24 Oct 1999 21:09:14 GMT
From: kherron@sgum.mci.com (Kenneth Herron)
Subject: Re: Oh god! Not another Net::ftp question!
Message-Id: <7uvshq$c2t$0@dosa.alt.net>

In article <7usbb5$k1j$1@nnrp1.deja.com>,  <ndietsch@yahoo.com> wrote:
>Kenneth,
>
>I believe you are mistaken.
>
>Perl does return the messages from the FTP server in $@
>
>If I have miunderstood your statement, then that is another matter
>entirely.


I had in fact missed this statement in the documentation:

	If the constructor fails undef will be returned and an
	error message will be in $@

But that's not very useful, is it?  Aside from being vague about what
the error message will consist of, this only applies to the
constructor--we've opened the control port to the FTP server, but we
haven't even authenticated yet.  If the login() or get() method fails,
there's no documented way for the caller to construct a meaningful
explanation of the error that can be returned to the user.

It may be that $@ is set for other commands as well, but if the fact
isn't documented, Net:FTP might as well not bother.  The *documented*
Net::FTP API doesn't include a way for the programmer to access server
responses.
-- 
Kenneth Herron -- kherron@sgum.mci.com
"Netscape pollution must be eradicated."
    -- Jeff Raikes, Vice president, Microsoft


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

Date: Sun, 24 Oct 1999 20:49:40 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Perl Message Board problem
Message-Id: <Pine.HPP.3.95a.991024204427.3949K-100000@hpplus01.cern.ch>

On Sun, 24 Oct 1999, Iain wrote:

> WWWBoard by Matt Wright.
> 
> Does anyone have any ideas how I can solve this problem, 

I've found the faq-O-matic to be rather nice, and can form the basis of
quite a wide range of bulletin-board-type systems.  But I don't recall
it being reviewed here, so I'm not sure what the real experts think of
it.

http://www.dartmouth.edu/~jonh/ff-serve/cache/1.html

(thank goodness, that revolting colour scheme isn't compulsory!).

Now, what was your Perl language question?



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

Date: Sun, 24 Oct 1999 13:28:49 -0700
From: Iain <ebow2000NOebSPAM@aol.com.invalid>
Subject: Re: Perl Message Board problem
Message-Id: <004aa0e3.f1e78e32@usw-ex0106-042.remarq.com>

In article <Pine.HPP.3.95a.991024204427.3949K-100000@hpplus01.cern.ch>,
"Alan J. Flavell" <flavell@mail.cern.ch> wrote:

> Now, what was your Perl language question?

Thanks for the faq tip. The Perl language question is in my original
post. Look closely.

cheerz.

Iain

Sarcasm and newsgroup postings by regulars - tedious bedfellows...



* 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: Sun, 24 Oct 1999 20:57:40 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Perl Message Board problem
Message-Id: <38137198.E5C0BC07@home.com>

Iain wrote:
> 
> In article <Pine.HPP.3.95a.991024204427.3949K-100000@hpplus01.cern.ch>,
> "Alan J. Flavell" <flavell@mail.cern.ch> wrote:
> 
> > Now, what was your Perl language question?
> 
> Thanks for the faq tip. The Perl language question is in my original
> post. Look closely.

I have looked all over your original post and couldn't find it.  Is this
some kind of puzzle?

What a refreshing change from all the URGENT posts around here.   Not
only did you not demand an answer right away, but you are willing to
wait until we unravel your encoding.

I'll bet no one who could answer will decode the question before I do.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 24 Oct 1999 21:18:24 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl vs. REBOL
Message-Id: <7uvt30$gjm$1@gellyfish.btinternet.com>

On Sun, 24 Oct 1999 13:23:12 -0400 Billy Zhao wrote:
> Martien,
> 
> Again, if you actually read what I said, I did not ask for "you" to do my work
> for me.  I'm merely asking if anyone who has worked with Perl has had any
> experience with REBOL.  
> 

Bollocks.  You said :

>> I was just wondering if someone who has used REBOL and/or Perl can
>> run down a list of specs I have and tell me which language has the advantage
>> over the other?

So you want us to do *your* work for you.  You could go out and do some work,
learn the languages, spend some time evaluating the strengths and weaknesses
of each and make some decision for yourself, instead you come here and
when told what you are asking is inappropriate you start railing against
the advice thus guaranteeing that you will receive no further help.

Let us suppose that no-one here had ever used REBOL and you had no reason
to believe that they had so, how then would you frame your question ?

If you were an intelligent researcher you may frame the question without
loading it with comparison, without creating a confrontational situtation:
you pose a hypothesis to which the actual capabilities of a language
can be compared.  By asking for a direct comparison between two languages
you have already altered the potential result - this now becomes sociology
or quantuum physics and you have blown it.

Please go away and think for a while about your research technique, there
is no point for you to come back and counter every post that is made in this
thread - it simply does you a dis-service.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 24 Oct 1999 21:34:17 GMT
From: bblishA@TblackbeltDO.Tcom (Ben Blish)
Subject: Piggyback parameters on CGI script URL? Or... ?
Message-Id: <38137813.150122095@news.montanavision.net>

I have a situtation where I'm redirecting a browser from
a CGI script (script1.pl) which is running, to another,
(script2.pl) because no cookie was found. script2.pl does
some testing of the browser. If the browser is found able
to handle cookies, it's given the one it was missing, and
sent back to script1.pl with the right cookie; at that
point, script1.pl can continue normally. This all works
fine.

However, script1.pl has an environment that carries some
parameters from the HTML page that initiated it;
For example, such-and-such a button was pressed, or
such-and-such an item was selected from a dropdown list.

I need to carry those parameters to the second CGI script
that I'll invoke with...

 print "Location: http://www.domain.com/cgi-bin/script2.pl\n\n";

 ...because if the browser can handle cookies, and I re-invoke
script1.pl, I need to hand off the selections that were made.
Otherwise, the HTML page will need to be re-submitted, which
seems needlessly onerous for the surfer.

So, my questions revolve around:

o Is there a way to preserve or copy the enviroment of script1.pl
  so that script2.pl sees them just as script1.pl did? Then,
  this concept could be extended so that script1.pl could be
  called again from script2.pl and "think" it was invoked
  from the original HTML page, which would be perfect.

o Failing that, is there a way to pass parameters to script2.pl
  in or on the URL, much as a local anchor can be passed on the
  end of a regular anchor:

     <a href="http://www.domain.com/boo.html"></a>
     <a href="http://www.domain.com/boo.html#localname"></a>

o Failing either of those, any suggestions in any other realm,
  pointers to the PERL docs, etc.?

Thanks for any assistance on this.

--Ben




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

Date: Sun, 24 Oct 1999 23:08:31 +0200
From: Christian Wix <christian@wix.dk>
Subject: Problems with files
Message-Id: <3813754F.C30DCDAC@wix.dk>

Please help with the following code. Something is not working. (Server
error). The file "inform" is in the same dir. as the the script and
"navn" is correct.

#!/usr/bin/perl
# This is a test program
use CGI;
my $longname = param("navn");
open (FILE, ">> inform") or die "can't append to filename: $!";
print FILE $longname;
close (FILE); 

Thank you,

-- 
Christian Wix
Bergsøekollegiet 23,st - 2309
Søllerød
2850 Nærum
Denmark
Phone: +45 45505171-(tone)-2309 / +45 26258162
Email & www: mailto:christian@wix.dk - http://www.wix.dk
ICQ #21322285


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

Date: Sun, 24 Oct 1999 21:21:17 GMT
From: Marcel Grunauer <marcel.grunauer@lovely.net>
Subject: Re: Problems with files
Message-Id: <0YQTOCq8pQKxCCBh1kiYcDeeJ7BM@4ax.com>

On Sun, 24 Oct 1999 23:08:31 +0200, Christian Wix <christian@wix.dk>
wrote:

> Please help with the following code. Something is not working. (Server
> error). The file "inform" is in the same dir. as the the script and
> "navn" is correct.
> 
> #!/usr/bin/perl
> # This is a test program
> use CGI;
> my $longname = param("navn");
> open (FILE, ">> inform") or die "can't append to filename: $!";
> print FILE $longname;
> close (FILE); 

"Something" is not working. What might that something be?

	#!/usr/bin/perl -w
	use strict;

will help. You should also test the program from the command line
before uploading it to the server. But even then you can do something
to have error message appear in the browser window (to some extent):

	use CGI::Carp qw(fatalsToBrowser);

Apart from that there's a lot that can go wrong. Wrong permissions on
the file you're trying to append to, maybe lose the space between ">>"
and "inform", maybe param("navn") doesn't return a useful value, maybe
you don't return a useful response to the browser etc.


-- 
Marcel, Perl Padawan
sub AUTOLOAD{$_=$AUTOLOAD;s;.*::;;;y;_; ;;print}&Just_Another_Perl_Hacker;


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

Date: 24 Oct 1999 20:00:24 GMT
From: rdusemund@aol.com (RDusemund)
Subject: Re: removing newlines from a string.
Message-Id: <19991024160024.29625.00000645@ng-fz1.aol.com>

If your string has the name $string

   chomp $string;

is a way to cut the newline (\n) from end of the line.
Bob


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

Date: 24 Oct 1999 20:32:25 GMT
From: g@cw3.net (Gordon Clemmons)
Subject: Re: removing newlines from a string.
Message-Id: <7uvqcp$o3s$1@fu-berlin.de>

tom@no-spam.tnunn.demon.co.uk (Thomas Nunn) wrote in 
<FZxGcOARB1E4EwIH@tnunn.demon.co.uk>:

>sub strip_newlines{
>  undef $/;
>  $_ = $_[0];
>  s/\n/ /gso;
>  my $string = $_;
>  return $string;
>}
>
>Is this a good way to do it? 

In regards to lt lindley, i stand corrected:)
The above code is a bit much for what you need 
and in fact the s/// is as well.  Try using 
the tr/// instead.  for instance:

$string =~ tr/\n/ /;

From what i have seen, the tr/// command works 
faster than the s///  .
if you needed it to be in a subroutine you could try
something like this:

sub strip_newlines {
  $_[0] =~ tr/\n/ /;
  return($_[0]);
}
would be sort of silly tho eh?
thanks lt lindley.
-- Gordon --


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

Date: 24 Oct 1999 21:41:25 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: replacing special characters to %xx for browsers
Message-Id: <7uvue5$gk5$1@gellyfish.btinternet.com>

On Sun, 24 Oct 1999 15:09:15 GMT Marcel Grunauer wrote:
> $s =~ s/([^a-zA-Z0-9_.-])/uc sprintf("%%%02x",ord($1))/eg;

Or you could use the big 'X' and lose the 'uc' .... ;-}

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 24 Oct 1999 13:25:47 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Security on the web with Perl
Message-Id: <7uv1cr$g49$1@gellyfish.btinternet.com>

On Sat, 23 Oct 1999 23:59:26 -0500 Jim wrote:
>                                    the program is using CGIs, which are
> Perl.
> 

Wrong.  A program that uses the Common Gateway Interface can be written
in any language that supports its input and output requirements.

Next.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 24 Oct 1999 19:06:11 GMT
From: Howard <hxshxs@my-deja.com>
Subject: TokenParser
Message-Id: <7uvlb2$nju$1@nnrp1.deja.com>

when you use HTML::TokenParser

$p = HTML::TokenParser->new("file.html")
                                ^
                                |
                does this have to be a file on the disk?

I tried. it seems to be.

How can I use parse a $content without saving it on disk first?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 24 Oct 1999 21:39:47 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Web based email program
Message-Id: <7uvub3$gk2$1@gellyfish.btinternet.com>

On Sun, 24 Oct 1999 13:51:56 GMT bababozorg@aol.com wrote:
> Hi
> 
> does anyone know a good perl/cgi webbased email program like
> yahoo/hotmail?

You have come to the wrong place.  We talk about writing programs here.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Sun, 24 Oct 1999 16:07:48 -0400
From: bob <bob>
Subject: write binary?
Message-Id: <C2cTOBKL0x9fyaR=t9zoMHsp7CdL@4ax.com>

I am writing a perl script that will take data from an html form and
write that info into an html file on my server, along with some html
prescripted in there for looks.  The purpose of the script is an easy
user updated web page for name, email, phone, etc. . .  Only a week
into learning Perl I was surprised that I managed to get this done and
actually have Perl write the file to the server.  That was the first
hitch.  Now, I would like to be able to have the user upload an image
file (their logo) through the web browser and save it to the local
server.  I could then have the script print the image link into the
web page to pull it up, no prob.  I would rather access the file
locally rather that remotely via a simple url.  Problem is I can't
figure out how to SAVE the binary file onto the local server.  Did it
with the form output for the html no sweat all text.  I found a small
script at:

  http://webreview.com/wr/pub/98/08/14/perl  

 This works great for getting the image up on the web and the script
is set up to immediately write the contents of the file back to the
browser, thus showing the file you just uploaded.  Great, but, it
doesn't save the file to the server.  I am currently working on this
bit of script separately from the rest of the form inputs for clarity,
but I'm sure I can integrate it back into the main script when I get
it worked out.  I have fooled around with the print command using the
file handler option like with the text file and have seen references
to binmode and chr functions and have even gotten so far as to have
the script create the file name entered in the form in the directory I
want on the local server but it fails to write the actual data into
the file.  Basically I get a blank file.  I have trudged through
countless FAQ's and documentations and such with no clear explanation
for this question.  Most of the documentation that I have read seems
to expect a pretty extensive knowledge of the language, therefore most
of it flies over my head.    I am only posting this here because I am
going blind reading perldoc this and that and not finding a well
explained solution.  So, based on the form and script above.  What is
the simplest, most straight forward way to write that binary file to
disk?  I don't care about printing a  results page, I don't need one
and I could do that myself.  I don't care how many milliseconds it
took to upload the file or the exact revision number of the poster's
web browser.  I just need the tiny bit of needle in a haystack code
that will extract whatever information it needs from the uploaded
binary data file and save it to the local server.  I will have a
rename function later that will name the file to what I want so it
doesn't have to check to see if a filename exists or anything.  I'm
just going to write over it anyway five lines down with a rename
function.  If anyone knows how this can be accomplished easier or more
efficiently please let me know.  Also please keep in mind that I will
be adding this to a bigger script if I ever get it to work.  I am open
to any suggestions on using a different method of getting the file
uploaded.   This script uses the CGI.pm module as you will see.  Sorry
to be so long winded but wanted to get the point across as clearly as
possible.    Please let me know if more info would help.  Yes I know
this is partly a CGI.pm question but who in the world uses it more
than Perl programmers?  And the part I am having a problem with is in
the actually in the perl code.

Also,  Please place your vote for the absolute best overall Perl
reference/training book.  Thanks.  


Regards, 

Bobby


Ready with the fire extinguisher.  ;)


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

Date: Sun, 24 Oct 1999 20:22:41 GMT
From: Marcel Grunauer <marcel.grunauer@lovely.net>
Subject: Re: write binary?
Message-Id: <U3cTOJMdlkfl9w41wBS=eHBhgMyY@4ax.com>

On Sun, 24 Oct 1999 16:07:48 -0400, bob <bob> wrote:

> I am writing a perl script that will take data from an html form and
> write that info into an html file on my server, along with some html
> prescripted in there for looks.  The purpose of the script is an easy
> user updated web page for name, email, phone, etc. . .  Only a week
> into learning Perl I was surprised that I managed to get this done and
> actually have Perl write the file to the server.  That was the first
> hitch.  Now, I would like to be able to have the user upload an image
> file (their logo) through the web browser and save it to the local
> server.  I could then have the script print the image link into the
> web page to pull it up, no prob.  I would rather access the file
> locally rather that remotely via a simple url.  Problem is I can't
> figure out how to SAVE the binary file onto the local server.

The CGI module can do what you need. The following script is from
Lincoln Stein's book about CGI.pm and shows you how to get some
information about uploaded files.

	http://www.wiley.com/compbooks/stein/text/upload.txt

Now you can modify it to save the uploaded file:

	$file = param('upload');
	open(SAVE,">./the_file_name") || die $!;
	while (<$file>) {
		print SAVE $_;
	}
	close SAVE;

You also mentioned binmode(). AFAIK, it's only necessary to use
binmode() on a Windows system. So you'd binmode() the filehandle after
opening it.


-- 
Marcel, Perl Padawan
sub AUTOLOAD{$_=$AUTOLOAD;s;.*::;;;y;_; ;;print}&Just_Another_Perl_Hacker;


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

Date: Sun, 24 Oct 1999 22:59:07 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: write binary?
Message-Id: <Pine.HPP.3.95a.991024224711.3949M-100000@hpplus01.cern.ch>


On Sun, 24 Oct 1999, Marcel Grunauer wrote:

> 	http://www.wiley.com/compbooks/stein/text/upload.txt

Oh dear.  No -w flag.  And no taint checks.  And this from a respected
master of the art ;-)  Sorry, couldn't resist...

> Now you can modify it to save the uploaded file:
> 
> 	$file = param('upload');
> 	open(SAVE,">./the_file_name") || die $!;

Yup, that works fine as long as the file name is constant.  But you need
to caution the punter about all the nasty traps lying in wait for
someone who would create a file path specification based on data
received from the user.  And that's where the taint check could be
valuable too.  (Well, it caught a logical slip that I made when I
started applying this very script, so if it helps me, I'm sure it can
help others.) 

> You also mentioned binmode(). AFAIK, it's only necessary to use
> binmode() on a Windows system. 

As far as you know?  Well, I think I can confidently say that setting
binmode() when it's relevant, is harmless on _any_ system where Perl
runs.  So wouldn't it be safer to just do the right thing, even in the
situations where it actually has no effect?  Just a suggestion.   I've
never used MacPerl, but I would surmise that binmode is not without its
efficacy on that platform too.

And do I hear someone raise me a "use strict;"?




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 1168
**************************************


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