[9404] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2999 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 27 01:07:24 1998

Date: Fri, 26 Jun 98 22:01:12 -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           Fri, 26 Jun 1998     Volume: 8 Number: 2999

Today's topics:
        [Q] split ///, $variable <ryan@steelplan.com.au>
    Re: [Q] split ///, $variable <rra@stanford.edu>
    Re: Can someone explain the arrow operator ? <rra@stanford.edu>
    Re: Checking if a file does NOT exist <ryan@steelplan.com.au>
    Re: Ctrl+D not working; stuck in STDIN <xuchu@iscs.nus.edu.sg>
    Re: Ctrl+D not working; stuck in STDIN (Bob Trieger)
    Re: Ctrl+D not working; stuck in STDIN (Larry Rosler)
    Re: Ctrl+D not working; stuck in STDIN (Bob Trieger)
    Re: Ctrl+D not working; stuck in STDIN <xuchu@iscs.nus.edu.sg>
    Re: first language (Abigail)
    Re: flame everyone on sight (was Re: Perl and Delphi) (Abigail)
    Re: flame everyone on sight (was Re: Perl and Delphi) (T. Ames)
    Re: Flames.... <ljz@asfast.com>
    Re: Flames.... birgitt@my-dejanews.com
    Re: Flames.... (Abigail)
        FTP and socket.ph <kiththesilent@geocities.com>
    Re: Hiding the Perl source (John Stanley)
    Re: Hiding the Perl source (John Stanley)
    Re: Hiding the Perl source (Abigail)
    Re: how much filespace ? <rra@stanford.edu>
        Perl32 <STDIN> problem <xuchu@iscs.nus.edu.sg>
        POSTing data to a Perl script <ozslot@alphalink.com.au>
    Re: POSTing data to a Perl script <none@spam.com>
    Re: Regexp/Email header problem (Mark Mills)
        screenwidth <edgar@networld.org>
    Re: screenwidth (Craig Berry)
        shell script for alarming <jackiech@ktweb.kotel.co.kr>
    Re: shell script for alarming (Jeremy D. Zawodny)
    Re: Subroutine Variables (Ronald J Kimball)
    Re: Testing perl knowledge (John Stanley)
    Re: Wait Command in Perl (Mark Mills)
    Re: What module to download a gif? (-)
    Re: What module to download a gif? (Bob Trieger)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 27 Jun 1998 11:31:40 +0800
From: Ryan Snowden <ryan@steelplan.com.au>
Subject: [Q] split ///, $variable
Message-Id: <3594679C.7E4461DC@steelplan.com.au>

I have this problem with simple syntax - hence I cannot solve this
problem.

I have a nice filename fully pathed like:

    /u1/s/blah/path/tothe/wonderful/pathname//filename.zip

So, in order to strip everything down and get the filename
(filename.zip), I figured I'd split it up, save it into an array, and
then get value number [9]..  i think... anyway, /// won't do it
obviously.  How do I make the / in the middle of the / / be the split
character.

Oh..   and whats a better way to do this?  I feel this is a dumb way of
doing it since perl is smarter than this.

*shrug*
Ry.



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

Date: 26 Jun 1998 21:36:23 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: [Q] split ///, $variable
Message-Id: <m3vhpn8nqw.fsf@windlord.Stanford.EDU>

Ryan Snowden <ryan@steelplan.com.au> writes:

> I have a nice filename fully pathed like:

>     /u1/s/blah/path/tothe/wonderful/pathname//filename.zip

> So, in order to strip everything down and get the filename
> (filename.zip), I figured I'd split it up, save it into an array, and
> then get value number [9]..  i think... anyway, /// won't do it
> obviously.  How do I make the / in the middle of the / / be the split
> character.

@path = split (/\/+/, $filename);

should do it.  (I'm not sure if you can use the m%/+% syntax in the regex
that split uses, to avoid leaning toothpick syndrome.)

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 26 Jun 1998 18:05:47 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Can someone explain the arrow operator ?
Message-Id: <m3g1grac2c.fsf@windlord.Stanford.EDU>

Mark-Jason Dominus <mjd@op.net> writes:
> Russ Allbery  <rra@stanford.edu> wrote:

> I suppose you must draw the line somewhere though, because you
> presumably don't prefer

> 	${${$$x{y}}[3]}{z}

> to

> 	$x->{y}[3]{z}

> ?

Eh?  What's wrong with $$x{y}[3]{z}?

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Sat, 27 Jun 1998 11:26:39 +0800
From: Ryan Snowden <ryan@steelplan.com.au>
Subject: Re: Checking if a file does NOT exist
Message-Id: <3594666F.F719DCF0@steelplan.com.au>

So True!

I'm learning perl off examples, some oriely books, and a lot of
documentation.  It works for about 99% of the problems I have but sometimes
you miss key things relating to simple structure or something.

Some marketing genius said to me once "Why do all the work when people can do
it for you".  This doesn't apply to me - I looked through some reference
books - but..  it's funny how I can get my answer within 10 minutes of a post
:)

Cheers!
Ry!

Chrishabs@my-dejanews.com wrote:

> if (!-e $file or -z $file) {
>    ^
> You have some man page reading to do.
>
> Chris H.
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading





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

Date: 26 Jun 1998 08:36:22 GMT
From: wings <xuchu@iscs.nus.edu.sg>
Subject: Re: Ctrl+D not working; stuck in STDIN
Message-Id: <6mvmi6$edu44@id4.nus.edu.sg>

yes, i encountered the same problem. try Ctrl-Z instead. however, as in
the question i asked yesterday here, it has some problems too..

try this:

@strings = <STDIN>;
while (<@strings>) {
	print pop(@strings);
}

this is the exercise on Learning Perl, (llama book) PP201. doesnt work on
Win95 but ok on Unix and NT. dont know why thou.

-- 
wings
------
You cannot learn anything unless you almost know it already.

Email: xwings@usa.net, xuchu@iscs.nus.edu.sg
ICQ UIN: 1440319
http://gump.iscs.nus.edu.sg


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

Date: Sat, 27 Jun 1998 01:31:04 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Ctrl+D not working; stuck in STDIN
Message-Id: <6n1i4f$etq$1@ligarius.ultra.net>

[ posted and mailed ]

wings <xuchu@iscs.nus.edu.sg> wrote:
-> yes, i encountered the same problem. try Ctrl-Z instead. however, as in
-> the question i asked yesterday here, it has some problems too..
-> 
-> try this:
-> 
-> @strings = <STDIN>;
-> while (<@strings>) {
->         print pop(@strings);
-> }
-> 
-> this is the exercise on Learning Perl, (llama book) PP201. doesnt work on
-> Win95 but ok on Unix and NT. dont know why thou.

It works fine on both my win95 and NT 4.0 server machines

What do you mean when you say that it doesn't work? 



Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-286-0591
  and let the jerk that answers know that his
  toll free number was sent as spam. "


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

Date: Fri, 26 Jun 1998 19:06:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Ctrl+D not working; stuck in STDIN
Message-Id: <MPG.ffdf39245aeb1359896f7@nntp.hpl.hp.com>

In article <6n1i4f$etq$1@ligarius.ultra.net>, Bob Trieger 
<sowmaster@juicepigs.com> says...
> [ posted and mailed ]
> 
> wings <xuchu@iscs.nus.edu.sg> wrote:
> -> yes, i encountered the same problem. try Ctrl-Z instead. however, as in
> -> the question i asked yesterday here, it has some problems too..
> -> 
> -> try this:
> -> 
> -> @strings = <STDIN>;
> -> while (<@strings>) {
> ->         print pop(@strings);
> -> }
> -> 
> -> this is the exercise on Learning Perl, (llama book) PP201. doesnt work on
> -> Win95 but ok on Unix and NT. dont know why thou.
> 
> It works fine on both my win95 and NT 4.0 server machines
> 
> What do you mean when you say that it doesn't work? 

Can you explain what it means?  Without the angles around @strings, it 
reverses the input line by line, as expected.  With the angles, it prints 
the last line (on my Unix box).  As that looks like a file handle, I'm 
surprised it does anything at all.  (Learning Perl is in my office, so I 
can't check what it says about this example.)

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


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

Date: Sat, 27 Jun 1998 02:41:06 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Ctrl+D not working; stuck in STDIN
Message-Id: <6n1m7p$ijd$1@ligarius.ultra.net>

[ posted and mailed ]

lr@hpl.hp.com (Larry Rosler) wrote:
-> In article <6n1i4f$etq$1@ligarius.ultra.net>, Bob Trieger 
-> <sowmaster@juicepigs.com> says...
-> > [ posted and mailed ]
-> > 
-> > wings <xuchu@iscs.nus.edu.sg> wrote:
-> > -> yes, i encountered the same problem. try Ctrl-Z instead. however, as in
-> > -> the question i asked yesterday here, it has some problems too..
-> > -> 
-> > -> try this:
-> > -> 
-> > -> @strings = <STDIN>;
-> > -> while (<@strings>) {
-> > ->         print pop(@strings);
-> > -> }
-> > -> 
-> > -> this is the exercise on Learning Perl, (llama book) PP201. doesnt work
->  on
-> > -> Win95 but ok on Unix and NT. dont know why thou.
-> > 
-> > It works fine on both my win95 and NT 4.0 server machines
-> > 
-> > What do you mean when you say that it doesn't work? 
-> 
-> Can you explain what it means?  Without the angles around @strings, it 
-> reverses the input line by line, as expected.  With the angles, it prints 
-> the last line (on my Unix box).  As that looks like a file handle, I'm 
-> surprised it does anything at all.  (Learning Perl is in my office, so I 
-> can't check what it says about this example.)
-> 

Does same thing with or without angle ops on my machine. Unfortunately my 
learning perl books are at the office too, so I can't look it up. Hopefully 
somebody else will for us.




Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-286-0591
  and let the jerk that answers know that his
  toll free number was sent as spam. "


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

Date: 27 Jun 1998 03:10:30 GMT
From: wings <xuchu@iscs.nus.edu.sg>
Subject: Re: Ctrl+D not working; stuck in STDIN
Message-Id: <6n1nr6$hf05@id4.nus.edu.sg>

Larry Rosler <lr@hpl.hp.com> wrote:
: In article <6n1i4f$etq$1@ligarius.ultra.net>, Bob Trieger 
: <sowmaster@juicepigs.com> says...
:> [ posted and mailed ]
:> 
:> wings <xuchu@iscs.nus.edu.sg> wrote:
:> -> yes, i encountered the same problem. try Ctrl-Z instead. however, as in
:> -> the question i asked yesterday here, it has some problems too..
:> -> 
:> -> try this:
:> -> 
:> -> @strings = <STDIN>;
:> -> while (<@strings>) {
             ^^^^^^^^^^  -- sorry, typo.. should be w/o angles!

:> ->         print pop(@strings);
:> -> }
:> -> 
:> 
:> What do you mean when you say that it doesn't work? 

what i mean is that on Windows 95, say the input is as follows:
aa
bb
cc
the output is supposed to be:
cc    ---> this line lost in Windows95!
bb
aa

however, as above, the last line of input is lost in win95! 
what's the problem?


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

Date: 27 Jun 1998 04:53:05 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: first language
Message-Id: <6n1trh$pjs$3@client3.news.psi.net>

Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCLX September
MCMXCIII in <URL: news:6n16r7$9f9$2@csnews.cs.colorado.edu>:
++  [courtesy cc of this posting sent to cited author via email]
++ 
++ In comp.lang.perl.misc, 
++     John.Adams@BentonvilleAR.ncr.com writes:
++ :And I have to second that emotion from whomever (Abigail?) recommended
++ :Knuth's books. I've only bought volume two (Sorting and Searching), but
++ :I wouldn't be without it.
++ 
++ Agreed whole-heartedly.  But it's "whoever". :-)


Just a minor point: Sorting and Searching is volume 3.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: 27 Jun 1998 01:18:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: flame everyone on sight (was Re: Perl and Delphi)
Message-Id: <6n1h8h$o8o$1@client3.news.psi.net>

Russell Schulz (Russell_Schulz@locutus.ofB.ORG) wrote on MDCCLX September
MCMXCIII in <URL: news:19980626.124656.8g2.rnr.w164w_-_@locutus.ofB.ORG>:
++ Dan Nguyen <nguyend7@egr.msu.edu> writes:
++ 
++ >> Is the a library for Perl that can be run under Delphi?
++ >
++ > Why would you want to program in Delphi?
++ 
++ now, was there any reason for this?  or was it just incredibly poorly
++ stated?  did you mean:
++ 
++   whatever you can do in Delphi you can do in Perl, and easier


I wouldn't mind programming in Delphi for a while.



Abigail
-- 
Greece isn't that bad.


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

Date: Sat, 27 Jun 1998 03:06:02 GMT
From: ames0009@tc.umn.edu (T. Ames)
Subject: Re: flame everyone on sight (was Re: Perl and Delphi)
Message-Id: <35946129.2427957@news.tc.umn.edu>

On 27 Jun 1998 01:18:09 GMT, abigail@fnx.com (Abigail) wrote:

>++ 
>++   whatever you can do in Delphi you can do in Perl, and easier
>
>
>I wouldn't mind programming in Delphi for a while.
>
>Abigail
>-- 
>Greece isn't that bad.

See, I knew some people came here "in the guise of an oracle."




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

Date: 26 Jun 1998 20:58:57 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Flames....
Message-Id: <lt67hnr772.fsf@asfast.com>

fl_aggie@thepentagon.com (I R A Aggie) writes:

> In article <6mv4td$opn$1@Venus.mcs.net>, les@MCS.COM (Leslie Mikesell) wrote:
> 
> [ ... ]
> + 
> + In my earlier post I questioned why CGI related topics were often
> + roasted as inappropriate for c.l.p.m, yet they are clearly going
> + to be a large part of the perl conference.
> 
> Ummm...because the "perl conference" != "clpm"? because there is a
> seperate newsgroup devoted to all things CGI, and that CGI questions
> stand a much better chance of being answered there where there are
> occasional CGI experts, than here where there are occasional perl
> experts who may or may not understand CGI?
> 
> If you want to mix-n-match, why not just have _one_ newsgroup.

Actually, I would very much be in favor of a c.l.p.cgi newsgroup.
This proposal has been rejected in the past, but perhaps now might be
a good time to revisit this idea.  Any thoughts?

-- 
 Lloyd Zusman   ljz@asfast.com
 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'


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

Date: Sat, 27 Jun 1998 03:35:50 GMT
From: birgitt@my-dejanews.com
Subject: Re: Flames....
Message-Id: <6n1pan$3v4$1@nnrp1.dejanews.com>

In article <1db8npb.7s0bqzwnp8gvN@roxboro0-044.dyn.interpath.net>,
  phenix@interpath.com (John Moreno) wrote:
>
> Leslie Mikesell <les@MCS.COM> wrote:
>
> > I R A Aggie <fl_aggie@thepentagon.com> wrote:
> > However the rude brush-offs and references to consulting fees and
> > commercial products are just out of place.

I would agree. The borderline between a paying customer who might
overpay a self-taught, novice wannabe programmer and a
wannabe programmer who looks for free help here, but intends to use
what he gets for free, to charge his customers for, is very slim.

Both types are lurking, reading and may be posting inappropriate
questions here.

The pain is on the side of those who are paying for services to
people who reveal here how funny it is when they try to get rid
of a customer's project in charging extreme prices and then
nevertheless get it, happily abusing the customer's non-programming
status. In no other profession would you find that kind of behaviour.

No mercy here.   *plonk*.

>
> > I'm convinced that the reason that new perl users don't read the newsgroup
> > to learn about the common problems before posting is that it is just too
> > painful.
>
> This seems absurd - what evidence or even hint do you base this on?
>

It is at times painful, the way it is painful to go pregnant nine
month to deliver a baby you wanted to have.

Meaning, someone who is serious about learning to program and learning
Perl, will read the newsgroup and not quit. One knows it is worth while.
Too bad one can't much do about that initial 'vomiting' period of the
first three month. :-)

Birgitt Funk

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


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

Date: 27 Jun 1998 04:40:49 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Flames....
Message-Id: <6n1t4h$pjs$1@client3.news.psi.net>

Lloyd Zusman (ljz@asfast.com) wrote on MDCCLXI September MCMXCIII in
<URL: news:lt67hnr772.fsf@asfast.com>:
++ fl_aggie@thepentagon.com (I R A Aggie) writes:
++ 
++ > In article <6mv4td$opn$1@Venus.mcs.net>, les@MCS.COM (Leslie Mikesell) wrote:
++ > 
++ > [ ... ]
++ > + 
++ > + In my earlier post I questioned why CGI related topics were often
++ > + roasted as inappropriate for c.l.p.m, yet they are clearly going
++ > + to be a large part of the perl conference.
++ > 
++ > Ummm...because the "perl conference" != "clpm"? because there is a
++ > seperate newsgroup devoted to all things CGI, and that CGI questions
++ > stand a much better chance of being answered there where there are
++ > occasional CGI experts, than here where there are occasional perl
++ > experts who may or may not understand CGI?
++ > 
++ > If you want to mix-n-match, why not just have _one_ newsgroup.
++ 
++ Actually, I would very much be in favor of a c.l.p.cgi newsgroup.
++ This proposal has been rejected in the past, but perhaps now might be
++ a good time to revisit this idea.  Any thoughts?


There is nothing cgi specific to perl that warrants a c.l.perl.cgi
group. I doubt there's anything perl specific to cgi that warrants
a c.i.w.a.cgi.perl group, but the people in c.i.w.a.cgi might agree
with you.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: Fri, 26 Jun 1998 23:55:04 -0500
From: kts <kiththesilent@geocities.com>
Subject: FTP and socket.ph
Message-Id: <35947B28.6D47@geocities.com>

Hello Im trying to setit  up so that i can use Perl to ftp (calling a
perlscrip from Powerbuilder transfer some files etc) but i keep getting
an error telling me it cant find the sys\socket.ph file.

Im using Win NT4 svcpk3...any ideas on what my problem is ??

Thanks in advance.

G. Wil Arnold


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

Date: 27 Jun 1998 01:15:37 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Hiding the Perl source
Message-Id: <6n1h3p$ji4$1@news.NERO.NET>

In article <eli$9806261259@qz.little-neck.ny.us>,
Eli the Bearded  <*@qz.to> wrote:
>Tough. If a program reads a file, I can find out about it without looking
>at the code. There is nothing you can do about it.

Every time this discussion takes place, a whole slew of people start
telling everyone how they can determine the secret so it isn't any
secret at all. "I can truss your code and see what it does." "I can
monitor the file system and see what it does." 

Security is not a yes/no, 1/0, black/white issue. "Security" is a real
number.  The amount of security necessary depends on how much you need
to protect something, or how much you want to protect it.  "Security
through obscurity is a horrible lie", or words to that effect, show up
every so often. Security through obscurity might very well be sufficient
for the purpose, however.

>It may be a *valid* reason, but it is not going to be a successful one.

That depends on who is trying to learn the secret. For many people, yes,
it will be quite successful. For you, no, it might not be, but then, you
probably aren't going to use his software. The pointy haired manager who
thinks "truss" is what he wears under his pants won't figure the secret
out, and that may be the target audience for the code. 

You have a lock on the door to your car. I know how to pick locks. You
might as well take the lock off your car, it isn't secure. Even if I
didn't know how to pick locks, I know how to rip the ignition lock out
of the steering column. You might as well leave your keys in the car
because the locks you are using are not secure. 

>Don't expect a lot of people to be in a hurry to help though.

And do expect a lot of people to be in a hurry to flame.



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

Date: 27 Jun 1998 01:16:59 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Hiding the Perl source
Message-Id: <6n1h6b$jig$1@news.NERO.NET>

In article <6muia5$9au$5@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>I said it was anti-social to expect the tools you are developing
>with to be free, yet the things you are developing shouldn't be.

It is as anti-social to say that your code is free but then tell people
that you don't want them to use it for things you don't like.



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

Date: 27 Jun 1998 04:51:08 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Hiding the Perl source
Message-Id: <6n1tns$pjs$2@client3.news.psi.net>

John Stanley (stanley@skyking.OCE.ORST.EDU) wrote on MDCCLXI September
MCMXCIII in <URL: news:6n1h6b$jig$1@news.NERO.NET>:
++ In article <6muia5$9au$5@client3.news.psi.net>,
++ Abigail <abigail@fnx.com> wrote:
++ >I said it was anti-social to expect the tools you are developing
++ >with to be free, yet the things you are developing shouldn't be.
++ 
++ It is as anti-social to say that your code is free but then tell people
++ that you don't want them to use it for things you don't like.


Your point being?



Abigail
-- 
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'


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

Date: 26 Jun 1998 18:06:39 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: how much filespace ?
Message-Id: <m3d8bvac0w.fsf@windlord.Stanford.EDU>

Freddy <freddy@postme.com> writes:

> i have a very newbie question. i want to know all filespace used down a
> named directory. how is that done the easy way? i tested with "ls" but
> didn't get a simple answer.

>   root
>     var
>       test
>         job
>           mail
>           web
>           other

> my example: i want to know all used filespace from the directory "job"
> with the directories "mail", "web" and "other" all together.

du -s /var/test/job

This is one of those cases where better tools already exist to solve the
problem and reimplementing them in Perl is likely a waste of your time.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 25 Jun 1998 09:46:01 GMT
From: wings <xuchu@iscs.nus.edu.sg>
Subject: Perl32 <STDIN> problem
Message-Id: <6mt68p$bjl108@id4.nus.edu.sg>

hi, gurus:

i am testing the codes in "learning perl". as it asks abt reversing some lines
of input w/o using reverse(), i tried:

@strings = <STDIN>;
while (@strings) {
	print pop(@strings);
}


this works fine on UNIX and WinNT. however, when running on Win95, it always
'eats' the last line of input.. i am using activeware's Perl5.003, what's the
secret behind? is it about Ctrl-Z?

any help will be much appreciated.


-- 
wings
------
You cannot learn anything unless you almost know it already.

Email: xwings@usa.net, xuchu@iscs.nus.edu.sg
ICQ UIN: 1440319
http://gump.iscs.nus.edu.sg


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

Date: Sat, 27 Jun 1998 12:42:21 +1000
From: David Hamilton <ozslot@alphalink.com.au>
Subject: POSTing data to a Perl script
Message-Id: <35945C0D.12A2FEE6@alphalink.com.au>

I have been experimenting with POST ing data from an HTML form to a perl
script and I suspected it would be fairly straigt foward using something
like this:

Sub InfoGet {
 read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'});
@namevalues = split(/&/, $namevalues);
foreach $namevalue (@namevalues) {
($name, $value) = split(/=/, $namevalue);
$name =~ tr/+/ /;
$value =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$INPUT{$name} = $value;
}
$email = $INPUT{email};
}

I have found however, that this doesn't work and the data doesn't get
transfered somewhere along the line.  Is there anything that needs to be
set-up in the server directory to get things working?

Thanks,
>From David Hamilton



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

Date: Fri, 26 Jun 1998 17:38:53 -1000
From: "Locke" <none@spam.com>
Subject: Re: POSTing data to a Perl script
Message-Id: <35943f99.0@news.hawaii.rr.com>

I use cgi-lib.pl and don't worry about any of that :)
http://www.cgi-resources.com  <-- somewhere on that site under
scripts->perl->utilities or something

If you just want the sub, you can copy it from there.


David Hamilton wrote in message <35945C0D.12A2FEE6@alphalink.com.au>...
>I have been experimenting with POST ing data from an HTML form to a perl
>script and I suspected it would be fairly straigt foward using something
>like this:
>
>Sub InfoGet {
> read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'});
>@namevalues = split(/&/, $namevalues);
>foreach $namevalue (@namevalues) {
>($name, $value) = split(/=/, $namevalue);
>$name =~ tr/+/ /;
>$value =~ tr/+/ /;
>$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>$INPUT{$name} = $value;
>}
>$email = $INPUT{email};
>}
>
>I have found however, that this doesn't work and the data doesn't get
>transfered somewhere along the line.  Is there anything that needs to be
>set-up in the server directory to get things working?
>
>Thanks,
>From David Hamilton
>




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

Date: Sat, 27 Jun 1998 04:03:39 GMT
From: extremely+news@hostile.org (Mark Mills)
Subject: Re: Regexp/Email header problem
Message-Id: <35976d6c.597164732@news.ntr.net>

On 26 Jun 1998 16:46:32 GMT, williams@eisws25.jpl.nasa.gov (Peter
Williams) wrote:
> [posted && cc'd to original author]
> 
> I think I can answer this in two characters (or one variable): "$/".
> 
> If I understand you correctly, you want to take out _all_ the headers.
> By setting $/ to the empty string (or alternatively, "\n\n" should
> work for standard email), this will read in the input a paragraph
> at a time.  Your first "paragraph" should be the email headers:
> 
> 	$msg = './mail_msg';
> 
> 	$/ = "";
> 	open(MSG,$msg) or die "Can't open $msg: $!";
> 	$headers = <MSG>;
> 	print "HEADERS: [$headers]\n";
> 	while (<MSG>) {
> 		&do_what_thou_will($_);
> 	}
> 	close MSG;


Auugh, don't tell him that without the standard warning!

mucking with $/ can be bad for your code's health.

Use { } to localize that sort of change so that you don't break the
various other things that he relies on $/ being set to "\n" for and
forgot to mention...

	$msg= $onemailmessagewheaders;
	{  #I'm here to provide a context for local!
	local $/="";
	# above file munging
	} # end 'local'ization




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

Date: Sat, 27 Jun 1998 03:29:11 +0200
From: "E. Kunkeler" <edgar@networld.org>
Subject: screenwidth
Message-Id: <35944AE6.D715FA49@kunkeler.demon.nl>

I now use a little javascript which gives the screenwidth to a perl
script, but is it possible in perl to know the screenwidth without using
a javascript?

Thanks is advance.

Edgar.



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

Date: 27 Jun 1998 02:51:17 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: screenwidth
Message-Id: <6n1mn5$hjm$1@marina.cinenet.net>

E. Kunkeler (edgar@networld.org) wrote:
: I now use a little javascript which gives the screenwidth to a perl
: script, but is it possible in perl to know the screenwidth without using
: a javascript?

Perl doesn't know about screenwidths, or screens for that matter.  Perl
just parses source and does as it's told.  There are no Perl built-in
functions that know more about I/O than reading and writing file handles.

If this is a question related to producing HTML through CGI using a Perl
script to receive and process info generated by a Javascript app, then
you'll probably find more help in the CGI authoring newsgroup.  There's
nothing about that process which is Perl-specific; a (say) C++ CGI would
do the same things (using different detailed techniques) to pull it off.

General free advice:  If a Web-related question is still meaningful after
doing s/perl/C++/i on it, then it probably doesn't belong in this group.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Sat, 27 Jun 1998 12:10:40 +0900
From: Jackie Chong <jackiech@ktweb.kotel.co.kr>
Subject: shell script for alarming
Message-Id: <359462B0.C0D67E02@ktweb.kotel.co.kr>

hi, there

Have you guys have a perl script which can have sun workstation generate
beep sound on and on until the user disable it?  This script is needed
for alarming.  Since the event is already defined in the tool (hp
openview),  I just need  a script  which have the sun generate a
wav.file on and on until the operator disable(kill) it.

I would greatly appreciate any feedback.


jackie





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

Date: 26 Jun 1998 23:55:27 -0400
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: shell script for alarming
Message-Id: <m31zsb5wi8.fsf@peach.z.org>

Jackie Chong <jackiech@ktweb.kotel.co.kr> writes:

> Have you guys have a perl script which can have sun workstation generate
> beep sound on and on until the user disable it?  This script is needed
> for alarming.  Since the event is already defined in the tool (hp
> openview),  I just need  a script  which have the sun generate a
> wav.file on and on until the operator disable(kill) it.

Well, if you wanna annoy someone to death with a Perl script, that's
one way to do it. :-)

Something as simple as:

--- snip ---

#!/path/to/perl

while(1) {
	`command_to_play_sound_on_a_sun`;
}

--- snip ---

Ought to do the trick. But you can do the same sort of thing in sh,
csh, bash, ksh, and many other shells. Perl may be "overkill" for this
rather odd task, IMHO.

Of course, there are other ways to do this in Perl. I've simply
illustrated one that I think will be quite portable. :-)

Jeremy
-- 
Jeremy D. Zawodny                   Web Geek, Perl Hacker, etc.
http://www.wcnet.org/~jzawodn/      jzawodn@wcnet.org

LOAD "LINUX",8,1


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

Date: Sat, 27 Jun 1998 00:51:13 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Subroutine Variables
Message-Id: <1db9b9n.1kdkn01xtint6N@bay2-356.quincy.ziplink.net>

Alex Svetlev <svetleva@cs.purdue.edu> wrote:

>   Unfortunately I'm not. I'm declaring the variable only in the sub with
> "my", yet the old $bar is remembered next time I call &foo. That's what's
> perplexing me. Any clue?

Post a brief code sample which demonstrates this behavior, please.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 27 Jun 1998 01:01:42 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Testing perl knowledge
Message-Id: <6n1g9m$jb2$1@news.NERO.NET>

In article <eli$9806251708@qz.little-neck.ny.us>,
Eli the Bearded  <*@qz.to> wrote:
>> Judge:   Well, yes, we can fault it because in this state the term
>> 	"engineer" is reserved for those who have credentials from
>> 	recognized authorities. Sorry, but Chris Nandor isn't recognized.
>> 	You will be hanging out with Randal in a few months...
>
>Since when can a state "reserve" a word? 

s/term/title/

>Since when is Chris Nandor not recognized? 

I doubt that the State of Oregon has ever recognized him as a
certification authority for engineering titles. This leaves us with the
option of answering "since the big bang", or "since he was born".

>I have a Master's Degree in Science. I photocopied it out
>of my _Ask Dr. Science_ book. It is every bit as legitimate. 

No, I doubt that you would find any employer as generous in their
evaluation of the degree, especially if they didn't know your
definition.

>It is well within my rights to state (after
>being certified whatever by Chris) that I am a Chris Nandor Certified
>Whatever.

Yes, you may certainly call yourself a Certified Whatever. I'm simply
pointing out that in some places, if you call yourself an Engineer you
might be violating the law. Not that I care, I'm just pointing it out
in case there are people here who care about not violating laws and
such. If you aren't one of them, that's nice. Do what you will.



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

Date: Sat, 27 Jun 1998 04:13:10 GMT
From: extremely+news@hostile.org (Mark Mills)
Subject: Re: Wait Command in Perl
Message-Id: <35987030.597872670@news.ntr.net>

On Fri, 26 Jun 1998 09:14:33 -0400, "Michael Harrison"
<hostmaster@hosttech.com> wrote:

[[cc'ed to: admin@hosttech.com ]]
> I need to get a script to wait about 10-12 seconds while a file is produced.
> The script writes a request file for ICVerify and the needs to stall for
> 10-12 secs while the answer file is produced. My questions is, is there any
> easy way to do this.

sleep 12;  Be careful that is safe tho...  Read up on it...

> Second after I read in the .answer file I need to read only the first char
> of the file to see if it is an "A" or "N" and the give the result back to
> the client. What is and easy way to strip all char from a Filehandler but
> the first. chop() gets the last char, is there away to reverse that.

Lot's of ways.  Is the file real big?  You probably don't want to rip
the entire file into memory.

If the file is text'ish then $line=<FILEHANDLE> and use
$first=substr($line,0,1);

If the file is binary and small, use the same method, but if it is
really huge and there are no line breaks you should look into
the functions:

seek()
read()

Since you can easily just grab the first char that way...

Good Luck.

> Thanks.
> 
> send answers to admin@hosttech.com



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

Date: Sat, 27 Jun 1998 01:20:36 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: What module to download a gif?
Message-Id: <35944718.23280290@news2.cais.com>

Tom Phoenix <rootbeer@teleport.com> Said this:

>On Thu, 25 Jun 1998, it was written:
>
>> open (OUT, ">nastychickpic.gif");
>
>Even when your script is "just an example" (and perhaps especially in that
>case!) you should _always_ check the return value after opening a file.
>Thanks!


Far be it from me to interfere with your task as perl nazi, but I
totally disagree.  

I never use die and I never check the return value.  The reason I
don't is because I mostly use perl for web applications (cgi), and
because my first and primary purpose in writing CGIs is to produce
output to the user.  If I'm constantly die'ing whenever a file open is
failed, the user, who does not understand script debugging and only
wants to see neat flashy things and text and images on web pages, will
get annoyed and never return.  I'd rather that the "behind the scenes"
stuff not interfere.  If a file write fails, so be it.  If a failed
file write causes a problem for the user, that is worse than just
losing some data.

You cannot say that "you should _always_" do anything that is merely a
matter of programming form.  I don't know about you, but the time I
spent in computer science classes was to provide a foundation to my
programming and computer skills, not define them entirely.  Just
because some professor had a "die" fetish doesn't mean you need to
always seek out and scold anyone who fails to use die.

Probably more than 60% of my programs do NOT use die and yet they work
100% of the time, as intended.  Why should I _always_ use die?




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

Date: Sat, 27 Jun 1998 01:52:08 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: What module to download a gif?
Message-Id: <6n1jbu$etq$2@ligarius.ultra.net>

root.noharvest.\@not_even\here.com wrote:
-> Tom Phoenix <rootbeer@teleport.com> Said this:
-> 
-> >Even when your script is "just an example" (and perhaps especially in that
-> >case!) you should _always_ check the return value after opening a file.
-> >Thanks!
-> 
-> 
-> Far be it from me to interfere with your task as perl nazi, but I
-> totally disagree.  
 
Whoa! Wrong Tom you have there. Tom Phoenix is perhaps the most helpful person 
on Usenet!

-> I never use die and I never check the return value.  The reason I
-> don't is because I mostly use perl for web applications (cgi), and
-> because my first and primary purpose in writing CGIs is to produce
-> output to the user.  If I'm constantly die'ing whenever a file open is
-> failed, the user, who does not understand script debugging and only
-> wants to see neat flashy things and text and images on web pages, will
-> get annoyed and never return.  I'd rather that the "behind the scenes"
-> stuff not interfere.  If a file write fails, so be it.  If a failed
-> file write causes a problem for the user, that is worse than just
-> losing some data.

Then you  have no clue what you are doing.  Tom said nothing about using die, 
he said to check for the return value which is only common sense. That way if 
something fails, you can do something like retry it and it may work the second 
time. Much more appealing to a user than a broken image or "Document contains 
no data" error.

-> 
-> You cannot say that "you should _always_" do anything that is merely a
-> matter of programming form.  I don't know about you, but the time I
-> spent in computer science classes was to provide a foundation to my
-> programming and computer skills, not define them entirely.  Just
-> because some professor had a "die" fetish doesn't mean you need to
-> always seek out and scold anyone who fails to use die.


Read above.

-> Probably more than 60% of my programs do NOT use die and yet they work
-> 100% of the time, as intended.  Why should I _always_ use die?

Who said you should use die once, let alone always? And nobody's code works as 
intended 100% of the time. That statement has invalidated anything else you 
could say.

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-286-0591
  and let the jerk that answers know that his
  toll free number was sent as spam. "


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

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

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