[9329] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2924 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 20 23:07:42 1998

Date: Sat, 20 Jun 98 20:00:28 -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           Sat, 20 Jun 1998     Volume: 8 Number: 2924

Today's topics:
    Re: Apache 90 TimeOut (Abigail)
    Re: Error log processing <rootbeer@teleport.com>
    Re: Error log processing <rootbeer@teleport.com>
    Re: Finding similar text files - an approach (Dan Lucas)
    Re: first language (Abigail)
    Re: first language (Abigail)
    Re: first language <tchrist@mox.perl.com>
    Re: first language (Abigail)
    Re: Flames.... <rra@stanford.edu>
    Re: Flames.... dgris@rand.dimensional.com
    Re: Flames.... <rra@stanford.edu>
    Re: Flames.... <ljz@asfast.com>
    Re: Flames.... <ljz@asfast.com>
    Re: Flames.... (Abigail)
    Re: Flames.... <ljz@asfast.com>
    Re: Flames.... <ljz@asfast.com>
    Re: Flames.... <rootbeer@teleport.com>
    Re: Flames.... <ljz@asfast.com>
    Re: Flames.... <rootbeer@teleport.com>
    Re: Formmail 1.6 & "Print to TAB textfile" <rootbeer@teleport.com>
        HTML Forms - Checkbox data lhiller@compupartner-edm.com
        Key exists lhiller@compupartner-edm.com
    Re: Key exists <danboo@negia.net>
        make error: solaris: perl5.004_04 <cerling@means.net>
    Re: Newbie print << question <benread@usa.net>
    Re: Newbie print << question <rootbeer@teleport.com>
    Re: Parsing...... <rootbeer@teleport.com>
    Re: Problem with space in front of each line of text. <rootbeer@teleport.com>
    Re: REVIEW: Perl CGI Programming - No Experience Requir <ajohnson@gpu.srv.ualberta.ca>
    Re: Strip carriage return from cgi? <rootbeer@teleport.com>
    Re: What "mini" database (text?) to use? <rootbeer@teleport.com>
    Re: wrap() <luckys@geocities.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 21 Jun 1998 02:21:57 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Apache 90 TimeOut
Message-Id: <6mhqo5$dmn$3@client3.news.psi.net>

Edward Harris (EdHarris@eg-web.com) wrote on MDCCLIV September MCMXCIII
in <URL: news:358BCB38.5BC4@eg-web.com>:
++ Apache will not allow a perl script to process for more than 90 seconds
++ without a request. On second 91 it stops the scripts processing and
++ sends the browser an "Internal Server Error" message.
++ 
++ Does anyone know any code or way to trick Apache into allowing a script
++ to process for more than 90 seconds?

I had to think for a while what this has to do with Perl, but at
least I found an answer that uses perl.

$ cd /usr/local/src/apache
$ perl -i -wne 's/90/300/g' *.c *.h
$ make depend
$ make
$ make install
$ kill -TERM `cat /usr/local/etc/httpd/logs/pid`
$ nohup /usr/local/etc/httpd/httpd &



Abigail
-- 
perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'


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

Date: Sun, 21 Jun 1998 01:51:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Error log processing
Message-Id: <Pine.GSO.3.96.980620185103.20995F-100000@user2.teleport.com>

On Sat, 20 Jun 1998, Scott wrote:

> open (FILE,"log");

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!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 21 Jun 1998 01:52:17 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Error log processing
Message-Id: <Pine.GSO.3.96.980620185149.20995G-100000@user2.teleport.com>

On Sat, 20 Jun 1998, it was written:

> open (IN, "temp.txt");

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!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 21 Jun 1998 01:39:31 GMT
From: dlucas@deletethis.gol.com (Dan Lucas)
Subject: Re: Finding similar text files - an approach
Message-Id: <358c63f3.35505724@nnrp.gol.com>

On Sat, 20 Jun 1998 07:35:44 GMT, Eric Bohlman <ebohlman@netcom.com>
wrote:

>This is the exact same thing that a spam-detector program does, if you 
>stop to think about it.  You might want to do a search for source code to 
>either spam detectors or spam filters, since their authors have had to 
>cope with all the various ways that spammers can "minimally customize" 
>their junk.

Thanks for the tip Eric. I'll look around.

Dan




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

Date: 21 Jun 1998 00:41:00 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: first language
Message-Id: <6mhkqs$c4m$2@client3.news.psi.net>

Deva Seetharam (psdspss@execpc.com) wrote on MDCCLIII September MCMXCIII
in <URL: news:358AA28C.1882F4F9@execpc.com>:
++ 
++ 
++ 
++ "programming" and "Programming" are not the same.
++ Point is not whether somebody can learn to write a few lines of code;
++ But whether he/she can use the programming lang. to solve a real world problem
++ efficiently, elegantly and **effectively**.
++ 
++ Programming is undoubtedly an art.
++ It requires a brilliant mind to understand the problem domain, conceptualize
++ a suitable data structure and employ an efficient algorithm to produce
++ an elegant solution.


Then you are entering the world of algorithm design; which is something
I don't see programmers do very often. But algorithm design isn't art
either. It's just a lot of work.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: 21 Jun 1998 01:51:06 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: first language
Message-Id: <6mhoua$dbs$1@client3.news.psi.net>

Snowhare (snowhare@devilbunnies.org) wrote on MDCCLIV September MCMXCIII
in <URL: news:6mgh0j$6o9$1@supernews.com>:
++ 
++ 
++ Nothing above this line is part of the signed message.
++ 
++ In article <6me68f$ijt$1@client3.news.psi.net>,
++ Abigail <abigail@fnx.com> wrote:
++ >That sounds as if programming would be an art. I disagree with that.
++ >I believe that most people can be able to learn how to program. Just
++ >like most people could learn how to become a car mechanic.
++ >
++ >Whether everyone has the motivation to learn is a different issue.
++ 
++ You've stepped right into one of the oldest debates in programming. 
++ I am on the programming as an art side.  I can teach a person all 
++ about the abstractions, the techniques, the theory and practice - 
++ but I can't give them the 'spark' that is the difference between 
++ what I'll call a 'cookbook' programmer and a 'chef' programmer. 
++ 
++ 'Cookbook' programmers can follow the recipies, answer the test 
++ questions and often do adequate maintenance programming where the
++ basic problem has already been solved. But don't ask them to start 
++ with a blank screen and a problem of significant proportions and 
++ successfully design a fast, elegant and well written system that
++ can be maintained easily. They can't. Their minds don't work that 
++ way. It requires the ability to literally _think_ in a programming
++ language with a high degree of creativity and absolute precision. 

I agree with that, up to where you say "programming language". 
Skilled programming/algorithm design isn't tied to a language.
Just like a car mechanic works on cars, and a 'chef' with food.
Of course, a mechanic can be specialized in a certain type of
car, and a chef can be famous for his chocolate recipies.

++ The 'chef' progammers are the ones who _write_ the recipies. 

Very much true. But even a non-chef cook can make an excellent meal.

++ In 18 years of programming, I've run into only a handful of
++ 'chef' programmers.

That's probably true for many professions.



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


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

Date: 21 Jun 1998 01:56:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: first language
Message-Id: <6mhp7g$nph$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
"T Jurik" <tjurik@li.net> writes in an address now published:

:Very good programmers do not have higher
:intelligence than other people in professional positions.  

A brilliant violinist might also not have higher intelligence
than an accountant.  But that doesn't mean you can automatically
make anyone a great violinist.  In fact, you cannot.  There are
gifts.  Do not forget this.

--tom
-- 
    "I think I'll side with the pissheads on this one." --Larry Wall


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

Date: 21 Jun 1998 02:10:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: first language
Message-Id: <6mhq1r$dmn$1@client3.news.psi.net>

birgitt@my-dejanews.com (birgitt@my-dejanews.com) wrote on MDCCLIII
September MCMXCIII in <URL: news:6mejaq$j5q$1@nnrp1.dejanews.com>:
++ In article <8cbtrpbgn2.fsf@gadget.cscaper.com>,
++   Randal Schwartz <merlyn@stonehenge.com> wrote:
++ >
++ > >>>>> "Dan" == Dan Nguyen <nguyend7@egr.msu.edu> writes:
++ >
++ > Dan> The person needs to be a "natural" programmer.  Generally I feel that
++ > Dan> most people have hard time not with the language but with the process
++ > Dan> of programming.  A person could learn Perl as a first language very
++ > Dan> easily and have no problems, while others could become stuck on the
++ > Dan> syntax of the language.
++ >
++ > I'll second this.  I see far too many people *attempting* programming
++ > that would probably have a better time being firefighters or line
++ > chefs or congressmen or something.  Sure, maybe nearly anyone with
++ > enough effort can hack out a VB script to automate a repeated task,
++ > but programming *well* seems to require a twisted aptitude only some
++ > small percentage of the population seems to have.  I think I was lucky
++ > to be born with it, given the time at which I was born. :-) No
++ > ordinary amount of education can seem to teach people how to "think"
++ > like a progammer.  ("You have these seven transformations possible and
++ > this problem requires converting Q to W... go!")
++ 
++ Aren't you both talking more about talent and gift ? No amount of
++ education in music composition seems to teach people either how to
++ compose like Beethoven.
++ 
++ The question, I think, was how you best learn to program. I have run
++ into many who believe that it is a matter of self-study and trial
++ and error. But I feel that is not enough.
++ 
++ What is then a structured way of learning how to program?  How is it
++ taught at universities? (Not that I think being a Ph.D.candidate in
++ computer science makes you an expert automatically, but at least there
++ is a fair chance that you might become one, whereas the chance to become
++ one through self-study is most probably quite remote).

Many universities don't make a fixed link programming <-> programming
language. When I went to university, the first 6 weeks of the course
"Introduction to Programming" consisted of Hoare triples and correctness
proofs. Later that course, we got Pascal, as you need something to your
lab sessions on. But after the first half year, any programming course
mainly used pseudo-code. If later on you needed a specific language;
you could get a pointer to a manual. Only in the third year, some other
languages were discussed, just to introduce different concepts.
It was the concept that was important, not the language that acted
as an example.

Pick a book like "Introduction to Algorithms" from Cormen, Leiserson
and Rivest. It doesn't use an existing language. It uses English,
pictures and pseudo-code. Buy the bible of Computing Science, "The
Art of Computer Programming" from Knuth. Algorithms are described in
English, and when code for algorithms is shown, a low level make up
language is used.

Learning how to program should not focus on a programming language.
It should focus on how to translate a problem into a recipe for a
computer. Just like learning how to drive shouldn't focus on how
to operate the radio or the automatic windows; but how to behave
in traffic.



Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

Date: 20 Jun 1998 18:03:29 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Flames....
Message-Id: <m3u35f4lcu.fsf@windlord.Stanford.EDU>

Tom Christiansen <tchrist@mox.perl.com> writes:
> "Michael D. Schleif" <mike.schleif@aquila.com> writes:

>> the documentation can be both tedious and enlightening.

> grep and ye shall find.

Am I the only one who thinks that a periodic posting on how to find things
in Perl documentation would be a good thing?  (This may already be
included in some of the others, but I don't think there's one that
specialized.)

-- 
#!/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: Sun, 21 Jun 1998 01:22:12 GMT
From: dgris@rand.dimensional.com
Subject: Re: Flames....
Message-Id: <6mhmkg$70e$1@rand.dimensional.com>

In article <m3u35f4lcu.fsf@windlord.Stanford.EDU>,
Russ Allbery  <rra@stanford.edu> wrote:

>Am I the only one who thinks that a periodic posting on how to find things
>in Perl documentation would be a good thing?

Perhaps posting perltoc once or twice a month would be worthwhile.

Daniel


-- 
Daniel Grisinger           dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
                           Dave Clark


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

Date: 20 Jun 1998 18:32:06 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Flames....
Message-Id: <m3hg1f4k15.fsf@windlord.Stanford.EDU>

dgris <dgris@rand.dimensional.com> writes:
> Russ Allbery <rra@stanford.edu> wrote:

>> Am I the only one who thinks that a periodic posting on how to find
>> things in Perl documentation would be a good thing?

> Perhaps posting perltoc once or twice a month would be worthwhile.

perltoc doesn't contain information on how to search through documentation
and find what you're looking for, pointers to the web documentation,
details on how to search on Windows or Mac platforms, and other
information that would be useful in a FAQ.

-- 
#!/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: 20 Jun 1998 22:02:50 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Flames....
Message-Id: <lt90mrwlyt.fsf@asfast.com>

Tom Christiansen <tchrist@mox.perl.com> writes:

>  [courtesy cc of this posting sent to cited author via email]
> 
> In comp.lang.perl.misc, 
>     Deva Seetharam <psdspss@execpc.com> writes:
> :If somebody thinks the question is stupid/irrelevant/repeated, why
> :can't he/she disregard the question ?
> 
> Because quite simply, when 95% of the group is buried under the same
> stupid question with repeated duplicate answers that are already in the
> docs, it dies the signal-to-noise death.  [ ... ]
> [ ... ]
> If we keep giving them hand-outs of free fish, they'll keep coming back
> for more instead of learning to fish on their own.  We shouldn't ignore
> them and leave them helpless, and we shouldn't give quick fixes that leave
> them dependent upon our continued care and feeding.  They should RTFM, or 
> else they're just crack addicts.

There seems to be a pervasive belief among a number of regular posters
here that people are either rugged individualists or "crack addicts".
These are two extremes at the ends of a spectrum.  This kind of
black-and-white dichotomy might be appropriate in the world described
in Ayn Rand's "Atlas Shrugged", where the book was being used as an
allegorical vehicle to make a philosophical point, but the real world
is not nearly so cut and dried as this.

In my experience, most people who get a short answer that also
includes a polite, respectful suggestion to go to the excellent
documentation do not become c.l.p.m "crack addicts".  Most of them are
self-motivated people who are grateful for the help, and who then go
on to the documentation and stop posting FAQ's.  I'm not sure where
this idea about a "pattern of addiction" comes from ... it seems to
reflect a rather jaundiced view of humanity that is not supported by
reality here in c.l.p.m.

And furthermore, since there are always new people trying out Perl and
coming into the group with FAQ's, I don't see what's wrong with being
polite and cheerful about referring these people to the documentation
instead of contriving one creatively glib and condescending put-down
after another, as a few people here are (sadly) wont to do.  The
polite reference to the docs will make the point just as clearly as
the sarcastic barb, and a kind, respectful approach like this says a
lot for the maturity of the one who uses it.

And from a purely pragmatic point of view, the number of irate,
indignant responses from new users will decrease if these people are
politely and kindly referred to the docs instead of being insulted,
and this can only have a positive effect on the signal-to-noice ratio
here.


-- 
 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: 20 Jun 1998 22:16:18 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Flames....
Message-Id: <lt67hvwlcd.fsf@asfast.com>

Tom Phoenix <rootbeer@teleport.com> writes:

> On 19 Jun 1998, Michael J Gebis wrote:
> 
> > The faq is big.  The docset for perl is big.  This is a good thing,
> > but it is not without problems.  It's hard to find stuff if you lack
> > context.  
> 
> A _few_ things may be hard to find, but the vast majority are easy to grep
> within a few seconds. [ ... ]
> 
> If you can't find something after a reasonable try, though, no one should
> flame you for asking here. Instead, we should see about improving the docs
> so that they'll help someone in the future. 
> 
> On the other hand, when someone fails to even _try_ to find an answer,
> firm discipline may encourage a little future effort. [ ... ]
> [ ... ]
> if you give a man a fish, he eats for a day. If you teach him to grep for
> fish, he'll leave you alone all weekend. If you encourage him to beg for
> fish, pretty soon c.l.p.misc will smell like a three-week-dead trout. I'm
> sure that saying goes something like that....

I disagree about using pre-emptive "firm discipline" for first-time
questioners.  Sure, it might be appropriate for those who repeatedly
and doggedly come here with FAQ's, but I hardly see anyone doing that.

A polite "thanks for your question; it's answered in the documentation
which can be found at ... etc." will steer most people to the docs as
quickly as something which is rude or insulting.  Therefore, in most
cases, the "firm discipline" serves no useful purpose that I can see.

As you once so aptly paraphrased me: "You can catch more flies with
honey than with vinegar" (and I won't even mention the connection
between flies and three-week-dead trout :)


-- 
 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: 21 Jun 1998 02:17:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Flames....
Message-Id: <6mhqg2$dmn$2@client3.news.psi.net>

T. Ames (ames0009@tc.umn.edu) wrote on MDCCLIV September MCMXCIII in
<URL: news:358c35a7.837222@news.tc.umn.edu>:
++ On 20 Jun 1998 19:09:04 GMT, Tom Christiansen <tchrist@mox.perl.com>
++ wrote:
++ 
++ >grep.  man -k.  less.  find.  whatever.
++ >
++ >If you haven't figured out how to search for things,
++ >turn off your computer until you can buy yourself
++ >a pet trainer.
++ >
++ >--tom
++ 
++ This is exactly the kind of response that the original poster was
++ addressing.  You are assuming that someone new to Perl and new to this
++ newsgroup (for those are the people who would post a simple question
++ or a question that is answered in the FAQ) already knows a) what
++ "grep" is and b) how to use it.  

If someone is new to Perl, I assume they did at least one of the following:
   - bought a collection of good books. (Llama and Camel for instance).
   - read perlfunc, perlop, perlsyn and the faq. Skimmed through the rest
     of the documentation.

Then you either have an index to use, or would know where to find what.
Now, if you don't want to buy a book, and your computer skills are so
low you can't even browse a file, you shouldn't be programming Perl anyway.




Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: 20 Jun 1998 22:29:04 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Flames....
Message-Id: <lt3eczwkr3.fsf@asfast.com>

"Matthew O. Persico" <mpersico@erols.com> writes:

> 1) Take it as a sign of respect that people would expect to get
> instantaneous answers to any question. They wouldn't ask if they thought
> the readers of the group were incompetent or unwilling to help.

Agreed.

> 2) Telling someone to FAQ, with maybe a specific section, and a gentle
> admonition to go and sin no more is perfectly accepatble.

Agreed.

> 3) Screaming, ranting and going postal is just rude. And even if you
> consider some nebie FAQ'able questions to be rude, why do you stoop to
> that level?

Muchly agreed!  We're responsible adults here, and we all know how to
control our emotional reactions ... especially when we have to
actually expend time and energy to put them in writing, and then make
a conscious choice to send them out.

> How about the "Standard RTFFAQ" clause:
> 
> [ ... snipped to save space ... ]
>
> Now, surely any decent mailer can include that file from your disk in
> your response. Even saves you the carpal-tunnel you get from ponding a
> keyboard in anger.
> 
> A little bit of courteousy goes a long way.

I fear that some people here actually take pleasure in composing and
sending out insults.  Therefore, posting a polite, canned, respectful
response such as your excellent example might leave them feeling
unfulfilled and frustrated.  For these people, I strongly suggest
pounding on a pillow with the word "Newbie" written on it.  Perhaps
someone good at embroidery could earn a little extra money by making
and selling such things.  :):):)


-- 
 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: 20 Jun 1998 22:37:37 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Flames....
Message-Id: <ltzpf7v5se.fsf@asfast.com>

Russ Allbery <rra@stanford.edu> writes:

> Tom Christiansen <tchrist@mox.perl.com> writes:
> > "Michael D. Schleif" <mike.schleif@aquila.com> writes:
> 
> >> the documentation can be both tedious and enlightening.
> 
> > grep and ye shall find.
> 
> Am I the only one who thinks that a periodic posting on how to find things
> in Perl documentation would be a good thing?  (This may already be
> included in some of the others, but I don't think there's one that
> specialized.)

I think that this would be very effective and efficient, and that it
would probably result in a very low CPTCLPM/NOPGTTDAAR ratio
("Characters Posted To c.l.p.m over Number Of People Going To The
Documenation As A Result").  This ratio helps the overall
signal-to-noise ratio here.

Given the 200+ posts that show up here daily, it might even be useful
to post this once every day.

-- 
 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: Sun, 21 Jun 1998 02:52:07 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Flames....
Message-Id: <Pine.GSO.3.96.980620193203.20995L-100000@user2.teleport.com>

On 20 Jun 1998, Russ Allbery wrote:

> Am I the only one who thinks that a periodic posting on how to find
> things in Perl documentation would be a good thing?

I doubt that such a posting would help - If someone can't figure out how
to search text files on their own, they probably aren't smart enough to
understand what they would find in the Perl docs if they did look. And if
they simply _won't_ look, they'll never read or heed your posting.

But don't let me stop you, if you want to make such a thing. Of course,
you shouldn't restrict it to the Perl docs - Make it general enough to
apply to any docs and FAQs, and cover searches on non-Unix machines as
well as Unix machines. Good luck with it! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 20 Jun 1998 22:56:00 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Flames....
Message-Id: <ltwwabv4xr.fsf@asfast.com>

abigail@fnx.com (Abigail) writes:

> T. Ames (ames0009@tc.umn.edu) wrote on MDCCLIV September MCMXCIII in
> <URL: news:358c35a7.837222@news.tc.umn.edu>:
> ++ On 20 Jun 1998 19:09:04 GMT, Tom Christiansen <tchrist@mox.perl.com>
> ++ wrote:
> ++ 
> ++ >grep.  man -k.  less.  find.  whatever.
> ++ >
> ++ >If you haven't figured out how to search for things,
> ++ >turn off your computer until you can buy yourself
> ++ >a pet trainer.
> ++ >
> ++ >--tom
> ++ 
> ++ This is exactly the kind of response that the original poster was
> ++ addressing.  You are assuming that someone new to Perl and new to this
> ++ newsgroup (for those are the people who would post a simple question
> ++ or a question that is answered in the FAQ) already knows a) what
> ++ "grep" is and b) how to use it.  
> 
> If someone is new to Perl, I assume they did at least one of the following:
>    - bought a collection of good books. (Llama and Camel for instance).
>    - read perlfunc, perlop, perlsyn and the faq. Skimmed through the rest
>      of the documentation.

That is a nice wish on your part, but unfortunately, not an accurate
assumption about the real world.

> Then you either have an index to use, or would know where to find
> what.  Now, if you don't want to buy a book, and your computer
> skills are so low you can't even browse a file, you shouldn't be
> programming Perl anyway.

I agree that someone who is unwilling to read documentation is not
likely to become a very good Perl programmer.  However, many of the
new users who come here with frequently asked questions are not people
who fit into this category.  Many first-timers don't even know about
the books or the documentation.  Sad, but true.  These users would be
happy to be informed of the existence of these resources, and so once
they get their automatically-generated mini-FAQ via email, I'm sure
that most of them then gladly go out and check the resources described
therein.

Of course, each of them would have to have posted at least one message
here before receiving this mini-FAQ, and often, this first-time post
consists of a frequently asked question.  So perhaps it's best if we
just trust in the reliability of the auto-mini-FAQ engine and refrain
from being too hard on these first-time posters while we patiently
wait for them to receive their mini-FAQ in the mail.


-- 
 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: Sun, 21 Jun 1998 02:59:24 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Flames....
Message-Id: <Pine.GSO.3.96.980620195233.20995M-100000@user2.teleport.com>

On Sun, 21 Jun 1998 dgris@rand.dimensional.com wrote:

> Perhaps posting perltoc once or twice a month would be worthwhile.

If they won't read it when it's already on their computer, why would they
read it when it's on Usenet? 

But I regularly post a message containing a URL which will lead interested
readers to perltoc (among other places). So far, I don't think it's helped
anyone, though. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 21 Jun 1998 02:12:10 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Formmail 1.6 & "Print to TAB textfile"
Message-Id: <Pine.GSO.3.96.980620190814.20995I-100000@user2.teleport.com>

On Sat, 20 Jun 1998, Gilles Raymond wrote:

[ 4 1/2 screenfuls snipped ]

> Everything seems to work perfectly... in the sense that I do not get any
> error message BUT nothing gets printed in the database.txt file. It's
> always blank ! ! !

[ another screenful snipped ]

Perhaps you could cut your example down to half a dozen lines and repost.
At worst, try to get it under a screenful. It's much more likely that
someone will take the time to read your message if that can be done in
less than an hour. :-)  

Somewhere in what I cut, I saw this:

>  #Write Data to Log file
>  open (OUT, "$dataprog");

Those double quotes aren't doing anything. 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. 

Also, this looked like it might be a CGI program. When you're having
trouble with a CGI program in Perl, you should first look at the
please-don't-be-offended-by-the-name Idiot's Guide to solving such
problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/





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

Date: Sun, 21 Jun 1998 01:16:08 GMT
From: lhiller@compupartner-edm.com
Subject: HTML Forms - Checkbox data
Message-Id: <6mhmso$mp0$1@nnrp1.dejanews.com>

Hi everyone,

What is the value sent to a perl "form-fetching" script when a checkbox is on
or off? Is this constant with all browsers?

Thanks in advance,
Jordan Hiller

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 21 Jun 1998 01:25:10 GMT
From: lhiller@compupartner-edm.com
Subject: Key exists
Message-Id: <6mhndl$nd0$1@nnrp1.dejanews.com>

Hi everyone,

How can I check if a has has a particular key defined?

Thanks,
Jordan Hiller

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sat, 20 Jun 1998 21:56:20 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Key exists
Message-Id: <358C6844.624B04B6@negia.net>

lhiller@compupartner-edm.com wrote:
> 
> Hi everyone,
> 
> How can I check if a has has a particular key defined?

i am guessing that you are looking to see if a key *exists* and not
whether it is defined. it is very rare that you would use a
key which exists but is undefined.

luckily perl has a builtin function called 'exists' which will
tell you if a given key exists in a hash. though it says nothing
about the value associated with that key. for this you would use
'defined'. you can find a full description in you favorite perl
documentation no doubt.

cheers,

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Sat, 20 Jun 1998 19:58:36 -0500
From: Roy D Cerling <cerling@means.net>
Subject: make error: solaris: perl5.004_04
Message-Id: <358C5ABC.B7F3AC29@means.net>

Attempting 'make' with gcc compiler .  In general, using defaults from
'Configure'.

I'm no programmer ... what's wrong with util.c?  How do I get past this
problem?

thanks,

(cerling@hazelnut):/d0-7/apps/perl/perl5.004_04
 ==> make
`sh  cflags libperl.a miniperlmain.o`  miniperlmain.c
          CCCMD =  gcc -DPERL_CORE -c  -O
`sh  cflags libperl.a perl.o`  perl.c
          CCCMD =  gcc -DPERL_CORE -c  -O
perl.c: In function `open_script':
perl.c:1862: warning: assignment makes pointer from integer without a
cast
`sh  cflags libperl.a malloc.o`  malloc.c
          CCCMD =  gcc -DPERL_CORE -c  -O
`sh  cflags libperl.a gv.o`  gv.c
          CCCMD =  gcc -DPERL_CORE -c  -O
`sh  cflags libperl.a toke.o`  toke.c
          CCCMD =  gcc -DPERL_CORE -c  -O
`sh  cflags libperl.a perly.o`  perly.c
          CCCMD =  gcc -DPERL_CORE -c  -O
`sh  cflags libperl.a op.o`  op.c
          CCCMD =  gcc -DPERL_CORE -c  -O
`sh  cflags libperl.a regcomp.o`  regcomp.c
          CCCMD =  gcc -DPERL_CORE -c  -O
`sh  cflags libperl.a dump.o`  dump.c
          CCCMD =  gcc -DPERL_CORE -c  -O
`sh  cflags libperl.a util.o`  util.c
          CCCMD =  gcc -DPERL_CORE -c  -O
util.c: In function `Perl_form':
util.c:1107: number of arguments doesn't match prototype
proto.h:125: prototype declaration
util.c: In function `Perl_die':
util.c:1164: number of arguments doesn't match prototype
proto.h:70: prototype declaration
util.c: In function `Perl_croak':
util.c:1231: argument `pat' doesn't match prototype
proto.h:47: prototype declaration
util.c:1231: number of arguments doesn't match prototype
proto.h:47: prototype declaration
util.c: In function `Perl_warn':
util.c:1288: number of arguments doesn't match prototype
proto.h:529: prototype declaration
util.c: In function `Perl_my_popen':
util.c:1818: warning: return makes pointer from integer without a cast
make: *** [util.o] Error 1

--
 ----------------------------------------------------------
 Roy Cerling  (cerling@means.net)     Rt 1 Box 45a
 HazelHill Logic Solutions            Wykoff, MN  55990
 Midwest Field Design Center          507 352-5000
 ----------------------------------------------------------





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

Date: Sat, 20 Jun 1998 19:02:56 -0500
From: "Ben Read" <benread@usa.net>
Subject: Re: Newbie print << question
Message-Id: <6mhicb$hvt$1@server2.wans.net>

Also make sure that there is a blank line after RESULTS-HEADER.  I had the
same problem when I started with PERL and didn't even realize that this
could affect your scripts.  Since then, I've always left at least one blank
line after terminators like that, especially considering the fact that it
can't hurt anything.

-Ben Read

>Can't find string terminator "RESULTS-HEADER" anywhere before EOF at

>RESULTS-HEADER
>
>I have tried a few different syntax changes at line 60 based on some
>messages in this newsgroup, but have not been able to get this sorted
>out.
>
>Any suggestions where I should begin to look?




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

Date: Sun, 21 Jun 1998 02:02:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Newbie print << question
Message-Id: <Pine.GSO.3.96.980620185353.20995H-100000@user2.teleport.com>

On Sat, 20 Jun 1998, Ben Read wrote:

> Also make sure that there is a blank line after RESULTS-HEADER.  I had
> the same problem when I started with PERL and didn't even realize that
> this could affect your scripts.  Since then, I've always left at least
> one blank line after terminators like that, especially considering the
> fact that it can't hurt anything. 

If that doesn't work, you could always sacrifice another chicken! :-)

You're not required to have a blank line after the end tag for the here
document. (Perhaps you were misled by the fact that you do need one
newline character after the end tag, so if the end tag is the _very_ last
thing in an (improper) text file which doesn't end with a final newline,
perl won't find the end tag.) 

Of course, a blank line can help readability, so don't let me stop you
from putting one in. But if your program isn't working, adding a blank
line after a here doc ain't gonna fix it! :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 21 Jun 1998 01:47:04 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Parsing......
Message-Id: <Pine.GSO.3.96.980620184452.20995E-100000@user2.teleport.com>

On Sat, 20 Jun 1998, Brad Jones wrote:

> I know this is probably not the best place to post this and i apologize
> in advance,

Speaking only for myself, your apology is accepted. But if this isn't the
best place for you to be getting your answer, no one should encourage you
by answering it here, right? :-)

> but I am trying to install some cgi perl scripts. We are using Linux
> Redhat and Apache, when I pull up the page in a browser it gives the
> text not the program, how do I fix this?

The docs, FAQs, and newsgroups about your server should be of assistance
to you on this. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 21 Jun 1998 01:30:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Problem with space in front of each line of text.
Message-Id: <Pine.GSO.3.96.980620182844.20995C-100000@user2.teleport.com>

On Sat, 20 Jun 1998, Leon Stepanian wrote:

> Subject: Problem with space in front of each line of text.

Each line after the first line? You're (almost certainly) interpolating an
array of lines, rather than simply printing it. If that's not it, make an
example program which demonstrates the difficulty, cut it down to no more
than half a dozen lines, and post it here. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 20 Jun 1998 19:45:40 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <358C57B4.4F3A3A6B@gpu.srv.ualberta.ca>

Rahul Dhesi wrote:
> 
[snip]
 
> When a list is on the LHS of an assignment, every element of it must be
> a variable.  This is why 'varlist' is a better term than just 'list' in
> this context.

$b='is';
$c="varlist";
($a,undef,substr($c,0,3)) = ('a',2,'');
print "$a $c is $a $c.\n";

regards
andrew


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

Date: Sun, 21 Jun 1998 02:17:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Strip carriage return from cgi?
Message-Id: <Pine.GSO.3.96.980620191242.20995J-100000@user2.teleport.com>

On 20 Jun 1998, Delta Charley wrote:

> Illegal character \015 (carriage return) at order_form.pl line 11.
> (Maybe you didn't strip carriage returns after a network transfer?)

> Can anybody advise as to the best way to strip the carriage returns?

Generally, the best way is to properly upload your file in the first
place. This means using 'text' or 'ascii' mode in your transfer program. 
But if you can't easily redo that, you can use a Perl one-liner to convert
it. Something like this works in most cases:

    perl -pi.bak -e 's/\x0D\x0A?/\n/g' filenames*

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 21 Jun 1998 02:30:23 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: What "mini" database (text?) to use?
Message-Id: <Pine.GSO.3.96.980620191910.20995K-100000@user2.teleport.com>

On Sat, 20 Jun 1998, Kay Molkenthin wrote:

> I heared of a text based perl database. What is the name and what do I
> need? 

There's nothing about a database which should _require_ perl; databases
are just data, after all. But there are many modules on CPAN which can
help you to build a database. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 20 Jun 1998 22:16:33 -0400
From: Luckys <luckys@geocities.com>
Subject: Re: wrap()
Message-Id: <358C6D01.642D@geocities.com>

Try something like this instead:


$MAIL_MSG_BODY = $HTML_MSG_BODY = $in{'message'};

format =
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
$MAIL_MSG_BODY
 .

open (MAIL, "| $SENDMAIL $addr") || die ("$SCRIPT: Can't open $mailprog:
$!\n");
print MAIL "Reply-to: $in{'from-name'} <$in{'from-email'}>\n";
print MAIL "From: $in{'from-name'} <$in{'from-email'}>\n";
print MAIL "To: $ADDRESS{$nick}\n";
print MAIL "Subject: $subject_header $in{'subject'}\n";

$oldhandle = select(MAIL);
$~ = STDOUT;
select($oldhandle);
write MAIL;

print MAIL "\n";
print MAIL "$in{'from-name'}\n";
print MAIL "$in{'from-email'}\n";
print MAIL "\n";
close (MAIL);



Glen wrote:
> 
> Has anyone used wrap() ?
> 
> I'm trying to perform the following to send an email, and wrapping
> long lines, but I just get no message contents being sent as a result
> of the print.
> 
> print MAIL wrap("","",$string);
> 
> Glen.


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

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

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