[8725] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2342 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 16 20:07:17 1998

Date: Thu, 16 Apr 98 17:00:26 -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           Thu, 16 Apr 1998     Volume: 8 Number: 2342

Today's topics:
    Re: .= so why not =. ? (warning: wasted bandwidth) <rra@stanford.edu>
    Re: .= so why not =. ? (Craig Berry)
    Re: Array / List question <ljz@asfast.com>
    Re: Book: Perl Modules (Eric Weiss)
        cgi perl ? <star@sonic.net>
    Re: CLPM CONTENT POLICE (was info on cookies) (Craig Berry)
    Re: commenting a whole block? (Andrew M. Langmead)
    Re: commenting a whole block? <danboo@negia.net>
        Deleting cookies from PERL (Mike Shannon)
    Re: Documentation Software for Perl <dean@tbone.biol.sc.edu>
    Re: Easy way to count lines in a file <vallon@pearl.fi.bear.com>
    Re: Easy way to count lines in a file (brian d foy)
    Re: Hash of Arrays (Kevin Reid)
    Re: Hash of Arrays <rdaniel@surfsouth.com>
        How to call an unix rsh in perl <peng@cae.cig.mot.com>
    Re: how to develop/test perl-cgi in local win32 develop <grinch@whoville.com>
    Re: how to develop/test perl-cgi in local win32 develop <dtbaker_@flash.net>
    Re: how to remove blanks? <dtbaker_@flash.net>
    Re: how to remove blanks? (Craig Berry)
        My macperl scripts don't shut down after 5 minutes as t <eslcafe@callisto.si.usherb.ca>
    Re: OOPS and several parents (Daniel)
        PIDs Finding and Killing them from a perl script (Michael Shavel)
    Re: Problem building perl on HPUX 10.20 hackworth@brewtek.com
        rand($.) (was wc-l in Perl) (Tom Mornini)
        Server Side Include (Jerry)
    Re: Server Side Include <sowmaster@juicepigs.com>
        shorten array <star@sonic.net>
    Re: shorten array (Craig Berry)
        Wanna laugh?  (My First cgi.pm Script) <lee@spam-me-not-darryl.com>
    Re: Weird Truncate Behavior <upsetter@shore.net>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 16 Apr 1998 16:02:44 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: .= so why not =. ? (warning: wasted bandwidth)
Message-Id: <m367k9pdyj.fsf@windlord.Stanford.EDU>

Bob Trieger <sowmaster@juicepigs.com> writes:

> When did "baz" come into being and how? I saw it used for the first time
> like 6 months ago.

>From the Jargon file:

:baz: /baz/ n.  1. The third {metasyntactic variable}
   "Suppose we have three functions: FOO, BAR, and BAZ.  FOO calls
   BAR, which calls BAZ...." (See also {fum}) 2. interj. A
   term of mild annoyance.  In this usage the term is often drawn out
   for 2 or 3 seconds, producing an effect not unlike the bleating of
   a sheep; /baaaaaaz/.  3. Occasionally appended to {foo} to
   produce `foobaz'.

   Earlier versions of this lexicon derived `baz' as a Stanford
   corruption of {bar}.  However, Pete Samson (compiler of the
   {TMRC} lexicon) reports it was already current when he joined TMRC
   in 1958.  He says "It came from "Pogo".  Albert the Alligator,
   when vexed or outraged, would shout `Bazz Fazz!' or `Rowrbazzle!'
   The club layout was said to model the (mythical) New England
   counties of Rowrfolk and Bassex (Rowrbazzle mingled with
   (Norfolk/Suffolk/Middlesex/Essex)."

-- 
#!/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: 16 Apr 1998 22:02:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: .= so why not =. ?
Message-Id: <6h5v5l$rgk$3@marina.cinenet.net>

Abigail (abigail@fnx.com) wrote:
: Brad Baxter (bmb@ginger.libs.uga.edu) wrote on MDCLXXXIX September
: MCMXCIII in <URL: news:Pine.A41.3.96.980416142149.63622C-100000@ginger.libs.uga.edu>:
: ++ Okay, following is not a perl question, but most FAQ's and books I've read
: ++ make use of the 'foobar' expression.  Considering what this stands for, is
: ++ anyone else out there slightly tired of seeing it, as am I?  Chances are
: ++ good that if I routinely used profane variable names in my posts, someone
: ++ would call me on it.
: 
: Uh, if foobar offends you, perhaps you shouldn't play with the grownups.

Oh, come on.  What offends or does not offend an individual is a very 
personal and subjective matter.  If anything, children tend to be less 
offended by rude language than adults, if only because they don't yet 
know enough about its subject matter.

In other words, Abigail:  Keep up the incisive algorithmic complexity 
posts.  But I'd suggest taking a breather on social engineering.  And 
perhaps a valium as well...

---------------------------------------------------------------------
   |   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: 16 Apr 1998 19:44:39 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Array / List question
Message-Id: <ltiuo9wcuw.fsf@asfast.com>

"A.P." <road@apdo.com> writes:

> Hi!
> I don't understand the behaviour of the following code:
> 
> print ((0,4)**2);
> 
> It prints 16, why doesn't it print 0? I discovered this trying to do it
> with an array. I'm a Perl beginner and I wondered if there was a way of
> doing some operation (like squaring) all the elements of an array/list
> without using a loop block. What I tried was:

I'm not sure if this is one of the things you're looking for, but just
in case ...

Here's a way to do squaring on all elements of a list:

   @result = map { $_ ** 2 } (0..4);

 ... or probably more efficiently ...

   @result = map { $_ * $_ } (0..4);

In both cases, `@result' will contain (0, 1, 4, 9, 16).

Just about any valid operation can be performed on `$_' within the
braces.

If you want alter the list itself, the following could be done (this
squares each element of `@list'):

   map { $_ **= 2 } @list
 ... or ...
   map { $_ *= $_ } @list;

In this usage, you need to be careful that the list to the immediate
right of the braces is an explicit, named list rather than an
anonymous one.

However, `map' makes use of a block, and there is an implicit loop.
I'm not sure whether or not this counts as a "loop block" by your
definition.

> [ ... ]

The rest of the points you have made in your post have been addressed
by other posters, so I won't repeat that info here.


-- 
 Lloyd Zusman
 ljz@asfast.com



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

Date: Thu, 16 Apr 1998 19:27:37 -0400
From: eweiss@winchendon.com (Eric Weiss)
Subject: Re: Book: Perl Modules
Message-Id: <MPG.fa05df09e66e2db9896d5@news.dgsys.com>

If you get Advance Perl, be sure to download the latest
errata pages from OReilly.  No wonder I had a hard time
getting many things to work and no wonder it totally 
confused me on a number of points (like dropping 'not' from
a critical sentence).  

Eric


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

Date: Thu, 16 Apr 1998 15:46:49 -0800
From: ~arthur <star@sonic.net>
Subject: cgi perl ?
Message-Id: <35369867.7AC0@sonic.net>

Hi,

I have a program from the camel book:

#!/usr/bin/perl -w
#easy cgi
use CGI qw(param);

print<<END_of_Multiline_Text;
Content type: text/html

<html>
   <head>
   <title>hiw-</title>
   <body>
   Hello World

END_of_Multiline_Text

my $favorite = param("flavor");
print "<P>Your favorite flavor is $flavor.";
print<<All_done;
</body>
</html>
All_done


-----
How do I get it to work on the web I have it at
http://www.sonic.net/cgi-bin/star/hiw- (dash is pat of the address)I
made it executable but how do I make it execute.

~arthur


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

Date: 16 Apr 1998 22:27:01 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: CLPM CONTENT POLICE (was info on cookies)
Message-Id: <6h60jl$rgk$5@marina.cinenet.net>

Abigail (abigail@fnx.com) wrote:
: Andrew F. Lee (andrewf@cp.pathfinder.com) wrote on MDCLXXXIX September
: MCMXCIII in <URL: news:Pine.GSO.3.95.980416155516.18074G-100000@cp.pathfinder.com>:
: ++ In my humble opinion, Perl and CGI are commmon companions.
: 
: You are wrong. Just the fact a majority of CGI programs are written
: in Perl doesn't mean the majority of Perl programs have anything
: to do with CGI.

I think 'common companions' is a weak enough assertion that I can support 
it.  I don't spend more than 20% of my time with my best friends, but 
we're still 'common companions.' :-)

: ++ I think that
: ++ CGI questions coming from a Perl programmer ought to be welcome on
: ++ comp.lang.perl.misc (misc being short for miscellaneous, from the Latin
: ++ miscellus -- mixed).
: 
: You are wrong. CGI questions should go to the CGI group. After all, a CGI
: programmer using C or a CGI programmer using Fortran might encounter the
: same problems. 

This is the key metric that I can't believe people keep missing.  I 
sometimes wonder if a large minority of CGI programmers simply don't 
understand that there's nothing magic about Perl as a CGI implementation 
language.

: ++ As a Perl programmer, I do not usually come to clpm questions about syntax
: ++ so much as questions about semantics.  Apologies to those who are studying
: ++ Perl in a vacuum with no intention of ever writing applications.
: 
: You are wrong. Many applications are written in Perl that have nothing to
: do with CGI.

And to expand on this, questions about semantics are (if anything) far 
more welcome in c.l.p.m than questions about syntax.  Syntax questions 
can generally be answered trivially by doc lookup or a quick experiment; 
semantics questions tend to be tougher and more interesting.

There are parts of Perl that are genuinely hard to understand (its 
approach to composite data structures, for example) or prone to 
misinterpretation (the semantics of reqular expressions, for example).  
There are many other topics such as these which are utterly welcome on 
c.l.p.m.

However, a question irrelevant to Perl as such (e.g., "How do I deal with
the user bouncing on the submit button," to paraphrase a recent example)
is both utterly off-topic for this group (Perl doesn't have submit buttons
and isn't a web server) and entirely topical for c.i.w.cgi.authoring.  In
the latter group, you can find out how Perl masters have solved this
problem -- and also how C++, C, Snobol, FORTRAN, and who knows how many
others have as well. 

Look at it this way:  Anybody on c.l.p.m who *can* answer a purely 
CGI-related problem is quite likely also reading c.i.w.c.a.  So why not 
just post appropriately?

---------------------------------------------------------------------
   |   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: Thu, 16 Apr 1998 22:31:34 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: commenting a whole block?
Message-Id: <ErJ2KM.46C@world.std.com>

Larry Rosler <lr@hpl.hp.com> writes:

>With all respect, this is a glib and totally useless response.  I
>followed your suggestion, and searched for "perl comment block", and
>got  19 totally irrelevant responses (only 7 of which were from "perl"
>groups, by the way).

Would it be preferable to point them to the FAQ entry "How can I
comment out a large block of perl code?" 
<URL:http://www.perl.com/CPAN/doc/manual/html/pod/
perlfaq7/How_can_I_comment_out_a_large_bl.html>

-- 
Andrew Langmead


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

Date: Thu, 16 Apr 1998 17:35:20 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: commenting a whole block?
Message-Id: <35367998.882BB11@negia.net>

Larry Rosler wrote:
> 
> brian d foy wrote:
> >
> > In article <Pine.GSO.3.96.980416144604.18264A-100000@romulus.rutgers.edu>, Ji Huang <jonhuang@romulus.rutgers.edu> posted:
> >
> > >I am a new user of perl and maybe i am not well informed but I really
> > >think it's extremely inconveniece in perl for me to bar a whole block of
> > >codes from executing.
> >
> > see the previous arguments and opinions on this topic by searching
> > Dejanews.
[SNIP]
> With all respect, this is a glib and totally useless response.  I
> followed your suggestion, and searched for "perl comment block", and
> got  19 totally irrelevant responses (only 7 of which were from "perl"
> groups, by the way).  I don't want to waste more time refining the
> search (adding "entire" reduced it to 1 irrelevant response, about
> "Python").

i think the problem here is knowing the tool. you got unrelated articles
because you searched unrelated newsgroups. try returning to dejanews and
use the "power search". in the text field labeled "Group(s)" enter a
group mask you wish to restrict your search to. in this case maybe
"comp.lang.perl.*". then try putting "comment block" in the "Search
for" text field (no need to specify "perl"), and click "Find". it's
truely an amazing resource once you are familiar with it's features.

cheers,
-- 
dan boorstein


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

Date: Fri, 17 Apr 1998 01:32:03 GMT
From: mshannon@lds.com (Mike Shannon)
Subject: Deleting cookies from PERL
Message-Id: <6h614l$6rb$2@newsreader.digex.net>

Hi,

I currently am developing a web site that requires a user to logon.
Once the user has logged on, information necessary to run the site is
stored to a number of cookies. These populated cookies act as
assurance that the user has in fact logged in. The problem is if the
user logs in through a kiosk, I want to be able to give him/her the
option to log off, which would mean invalidating the cookies...making
them go away...appearing to the perl programs as if the user had never
logged in.

Short of making the user close the browser, is there anyway to do this
programatically?

Thanks in advance...Mike

mshannon@lds.com




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

Date: 16 Apr 1998 17:28:33 -0400
From: Dean Pentcheff <dean@tbone.biol.sc.edu>
Subject: Re: Documentation Software for Perl
Message-Id: <87vhs978xq.fsf@tbone.biol.sc.edu>

"steve" <joe@microsoft.com> writes:
> Does anyone know of or use a product for Perl that will show a map of what
> functions call which functions?  It should draw out some sort of flow
> diagram of all the perl modules called.  And... if it could work w/html
> files, showing which html files call which perl modules then showing all
> the function links.

You'll want to check the Devel::DProf module.  Find it at your nearest
CPAN archive (which you can locate via http://www.perl.com/).

Not to be overly pedantic, but... HTML cannot and does not call
anything.  I suspect that what you mean is that your WWW server does
some sort of server-side include processing of your HTML files, and
those files may invoke Perl programs.  

How you'd convince your server to do execution profiling of its
server-side includes is a topic that you'll have to find out by
consulting your WWW server's documentation.  Don't be too suprised if
there isn't any such facility.  You may need to kludge things into
your Perl programs in order to trace their invocation by the WWW
server via server-side includes.  Since output to STDERR goes to the
server's error log file (probably - depends on the server) you could
get a decent trace of which Perl jobs get called by putting:

    print STDERR "$0 starting\n";

or something like that near the beginning of each Perl program.  

Best of luck!

-Dean
-- 
N. Dean Pentcheff                                          <pentcheff@acm.org>
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-7068)


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

Date: 16 Apr 1998 18:08:21 -0400
From: Justin Vallon <vallon@pearl.fi.bear.com>
Subject: Re: Easy way to count lines in a file
Message-Id: <x6eogy1mnca.fsf@pearl.fi.bear.com>

May I suggest just using the number of bytes in the file?  It should
give a very reasonable approximation of the number of lines.  So, you
could notify on every 1k lines, or 80k bytes.

Just a thought...


"Harold Reed" <hareed@bellsouth.net> writes:

> Is there an easy way to count the number of lines a file has? I am working
> with several access log files that are routinely larger than 300MB and I
> have developed a crude update that lets the user know every 1000 lines that
> are processed by the script - so you can get an idea of where the script is
> in it duties (a stdout update, if you will). Is there a way that you can get
> a readout of the number of lines in a file quickly? Currently I am using the
> incredibly CPU-expensive
> 
> while (<ACCESS>) {
>     counter++;
> }
> print "You have $counter lines in this file\n";
> 
> This is chewing mountains of time on a huge file as previously decribed. I
> have scoured for a way to count the number of lines - quickly (a la grep
> perhaps?) - but can't seem to find any sort of clue. Any prompts from the
> wizened?
> 
> Harold Reed

-- 
-Justin
vallon@bear.com


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

Date: Thu, 16 Apr 1998 18:27:20 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Easy way to count lines in a file
Message-Id: <comdog-ya02408000R1604981827200001@news.panix.com>
Keywords: from just another new york perl hacker

In article <x6eogy1mnca.fsf@pearl.fi.bear.com>, Justin Vallon <vallon@pearl.fi.bear.com> posted:

>May I suggest just using the number of bytes in the file?  It should
>give a very reasonable approximation of the number of lines.  So, you
>could notify on every 1k lines, or 80k bytes.

i'm curious how you translate bytes to lines.  for instance, i have
a data file that i'm avoiding at the moment - it's about 200 lines [1]
and about 500 characters per line.  another data file for the same
project has 6000 lines of about 20 characters per line.

lines are a completely arbitrary notion.  we think about an 80 character
length because that's what a lot of terminals do.  if it were line printers
we would toss about a number like 132.  if we have fixed length lines, then
this sort of thing might make sense, but otherwise it's just wild
guessing.

Perl even let's us redefine the input record separator, so the notion
of newline terminated "lines" is even fuzzy (i like form feeds myself).


[1] - considering a line as a newline terminated record.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: Thu, 16 Apr 1998 18:33:05 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Hash of Arrays
Message-Id: <1d7labs.6uts153hcchsN@slip166-72-108-252.ny.us.ibm.net>

Stephen Mubita <smubit1@gl.umbc.edu> wrote:

> On Wed, 15 Apr 1998, Ovanes Manucharyan wrote:
> 
> => How can I create a hash of Arrays.
> => For example, will this work?
> => 
> => @HASH{$index}=@array;
> => 
> => Do I need to create this data type? I tried to use this in my code and
> => it only stores the first element of the @array, am I doing something
> => wrong??
> 
> customized from page 266 of the Camel book (hashes of arrays):
> @myhash = (
>  $index => [ @array ],
> );

Er, shouldn't that be a % on the first line?:

%myhash = (
  $index => [ @array ],
);

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: Thu, 16 Apr 1998 17:37:55 +0000
From: randy <rdaniel@surfsouth.com>
Subject: Re: Hash of Arrays
Message-Id: <353641F3.2EE6F193@surfsouth.com>

Ovanes Manucharyan wrote:

> How can I create a hash of Arrays.
> For example, will this work?
>
> @HASH{$index}=@array;
>
> Do I need to create this data type? I tried to use this in my code and
> it only stores the first element of the @array, am I doing something
> wrong??
>
> Thanks is advance.
>
> Ovanes

  Try this. $HASH{$index} => [ ];
the brackets [ ] will contain the elements of the array. This is known as
an anonymous array.



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

Date: Thu, 16 Apr 1998 16:59:16 -0500
From: Ying Peng <peng@cae.cig.mot.com>
Subject: How to call an unix rsh in perl
Message-Id: <35367F34.C5873ADA@cae.cig.mot.com>

Dear Folks,

I am very new in the Perl world so may ask some dumb questions here.

Here is my question:

I want to use the following unix command in perl:

rsh B "/net/A/home/peng/1.tar /home/daok" <--Has to use "

I only know I can use the "system" function to call unix commands but
the problem is double quote. the system function requires the double
quote also such as:

system("ls");

Cannot use system('ls') or system(`ls`) as I observed so far.

Thanks very much for your great thought in advance.

--Ying

Motorola CAE/CIG/CAM support group


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

Date: Thu, 16 Apr 1998 17:58:28 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: how to develop/test perl-cgi in local win32 development environment?
Message-Id: <6h5u4d$54r@fridge.shore.net>

Dan Baker wrote in message <35363E6E.731F@flash.net>...

>I'm looking for some input from the experts on the best ways to test
>perl-cgi programs when developing in the win32 (windows95) environment.
>it is becoming clear to me that I need to have either some form of a
>local web server or Perl module/daemon emulating this sort of thing to
>make perl and HTML form data interact correctly....


I may be vilified for suggesting commercial software, but so be it. Here's
what I like:

The WebSite server from O'Reilly. <URL: http://software.ora.com > I like
this one because it gets along great with Perl even on Win95, and allows you
to specify the command-line switches to be used. Since Win95 doesn't support
the "#!" notation to do this, this feature is important. (see below)

The graphical Perl Debugger from ActiveState. <URL:
http://www.activestate.com >. You can use this to debug CGIs in their native
environment! Simply tell WebSite to use the '-d' (see above), it launches
the CGI script in the debugger! I think Larry Wall said it best: "Cool. I
wish it ran on UNIX." It works with both the standard the ActiveState
distributions.

-grinch

--
-----
"Yes, I'm paranoid, but that doesn't mean
no one's out to get me." - me

Sherm Pendley
grinch@whoville.com
http://www.whoville.com





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

Date: Thu, 16 Apr 1998 16:36:51 -0600
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: how to develop/test perl-cgi in local win32 development environment?
Message-Id: <35368803.1C78@flash.net>

Grinch wrote:
> 
> Dan Baker wrote in message <35363E6E.731F@flash.net>...
> 
> >I'm looking for some input from the experts on the best ways to test
> >perl-cgi programs when developing in the win32 (windows95) environment.
> >it is becoming clear to me that I need to have either some form of a
> >local web server or Perl module/daemon emulating this sort of thing to
> >make perl and HTML form data interact correctly....
> 
> I may be vilified for suggesting commercial software, but so be it. Here's
> what I like:
> 
> The WebSite server from O'Reilly. <URL: http://software.ora.com > I like
> this one because it gets along great with Perl even on Win95, and allows you
> to specify the command-line switches to be used. Since Win95 doesn't support
> the "#!" notation to do this, this feature is important. (see below)
-----------------

looks like awesome stuff.... but for $799, it's a little steep when all
I want to use it for is to test my HTML-cgi-perl application on a
windows95 machine. I don't NEED a killer webserver for real.

how about PWS from MS for free? I was just over there trying to figure
out which pieces to download (and confused by all the choices in the NT
option pack and whether I'd really need to download MSIE 4.0) If anyone
else has another option, or can give pointers on how to do a minimal
install of pws, I'd LOVE to see it!

Dan


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

Date: Thu, 16 Apr 1998 15:52:23 -0600
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: how to remove blanks?
Message-Id: <35367D97.41AB@flash.net>

Craig Berry wrote:
> 
> akogan (akogan@radiology.nwu.edu) wrote:
> : Can anyone tell me how to remove preceding and trailing spaces in a
> : string variable?
> 
> You know, this is the sort of question that gets newbies flamed around
> here...you've asked an almost word-for-word FAQ:
> 
>   perlfaq4/How_do_I_strip_blank_space_from_.html
> 
> (in the HTML version of the doc.) Read the FAQ.  Study the FAQ.  Check the
> FAQ before posting.  The FAQ is your friend.  The FAQ answers questions
> roughly 100 times faster than c.l.p.m, and much more reliably, too.
-----------

for the real NEW newbie, it would help if responders include the URL to
the FAQs. You went to all the trouble to post the page, but not the full
URL. I know I'm willing to go do some reading, but sometimes don't know
where to go to RTFM.  ;)

Dan


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

Date: 16 Apr 1998 22:14:45 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how to remove blanks?
Message-Id: <6h5vsl$rgk$4@marina.cinenet.net>

Dan Baker (dtbaker_@flash.net) wrote:
: for the real NEW newbie, it would help if responders include the URL to
: the FAQs. You went to all the trouble to post the page, but not the full
: URL. I know I'm willing to go do some reading, but sometimes don't know
: where to go to RTFM.  ;)

OK, here's the URL I used:

  file:///C|/Perl/docs/Perl/perlfaq.html

 ...now see why I didn't post it?  The FAQ is *already available right on 
the poster's machine!*  It's included with every Perl distribution.  
Going after it on the Net is a waste of time and energy (unless you need 
an updated copy, I suppose).  In other words, you don't need to 'go' 
beyond your own disk to RTFM.

Just in case anyone has a crippled installation or the like, here's one
place to find the FAQ on the Web; it's a mirrored CPAN-resident HTML
version reachable via a few obvious links from the Perl home page: 

  ftp://ftp.cs.colorado.edu/pub/perl/CPAN/doc/FAQs/FAQ/PerlFAQ.html

---------------------------------------------------------------------
   |   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: Thu, 16 Apr 1998 22:15:42 GMT
From: John Taylor-Johnston <eslcafe@callisto.si.usherb.ca>
Subject: My macperl scripts don't shut down after 5 minutes as they are supposed to
Message-Id: <33023903.2594@callisto.si.usherb.ca>

OK - we know we are doing something wrong! My macperl apps don't shut
down automatically after 5 minutes! And my server admin is in a tizzy.

	Most scripts are still running the next morning - sometimes it is the
same ones over and over. (They are saved as cgi-scripts!?) What I don't
understand is why can't I shut them down even when I double click on
them, receive the menu to shut them down, and click on shut down from my
station, in my directory! The sys admin has to do it himself. ... The
next morning he arrives, looks in teh finder menu and sees 5 or 10
macperl apps still running!  There must be a way to limit their time.

	(Don't they shut down automatically? Can I programme perl to shut them
down immedaitely after use? This is what pisses off my sys admin! It
doesn't matter which script I use from simple text reply to more
complicated.)

MORE INTERESTING
>From time to time, I get response from netscape that says that "The
document contains no data". It seems to be these that cause the trouble.
I rename them, (try to) erase them or otherwise and resave the app with
my back up file - this seems to overcome the problem - sometimes.  (I
have run the check syntax and ran the perl app before I try testing it
from the net.)

I'm wondering if I should save my apps as perl droplets, but they don't
seem to work.
For the moment my sys admin :-( has banished macperl from the main
server to another IP where I am to test and solve the problem with
macperl before he lets Macperl back in!

(I'm using Webstar 1.0 on a power mac. System 7, soon to be udated to
sys 8 and web star 3)

Thanks!
Please reply by e-mail


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

Date: 16 Apr 1998 22:47:44 GMT
From: daniel.mendyke@digital.com (Daniel)
Subject: Re: OOPS and several parents
Message-Id: <6h61qg$98j$2@nntpd.lkg.dec.com>


>But this makes numerous assumptions, e.g. that all
>the parents are constructed via methods called 'new';
>that all those new()s don't need any arguments; that
>all the blessed references they return are hash refs;
>that none of those hashes contain duplicate key strings.
>
>As tchrist mentioned, reblessing is ABT when you've got
>multiple inheritance.  In any case, I defer to his
>wisdom in these matters.


John,

I see the wisdom now.  ( Actually Tom send me an email
stating basically the same thing - Don't rebless! )

Still, multi inheritance has it's uses but having
to know all the parent classes that bless their
own objects don't seem to lead towards general reuse.

But it is rare to see actual multi inheritance and my
questions were only to end the fog in front of my eyes.

Daniel

==============================================
daniel@virtualvoices.com
Sell it OnLine at http://www.virtualvoices.com
==============================================



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

Date: Thu, 16 Apr 1998 19:37:18 -0400
From: mshavel@erols.com (Michael Shavel)
Subject: PIDs Finding and Killing them from a perl script
Message-Id: <mshavel-1604981937180001@130.9.16.207>

Hi


I have a perl script calling a csh script which then in turns calls an
sqrt statement on a Sybase database. 

I need the ability to kill the process I started from the perl script but
I am having problems getting the correct PID to kill. 

First off here is the short subroutine I use in the perl script:

$c = "some_script_for_cshell.csh";

$pid_num = execute_and_get_pid($c);
sub execute_and_get_pid
{
        my ($report) = @_;
        $pid = open(RUN,"|$report");
        return $pid;
        close (RUN);
}

What is returned to me in $pid is the PID of the csh script. I find that if I 
kill this PID (kill -9 $pid), It does not kill any children that the csh
script spawned (I can see this by doing several ps -ef's). So anything the
csh script might have called is still alive and running. 

Questions: 
1.Is there a specific option to"kill" that will kill the parent and 
all of it's children?

2. If the answer to #1 is no, is there a way for me to get the PID's of the 
children that are spawned?  (I tried using ps -ef |grep and then parsed
out the PID from the string returned but this seems error prone and not
exact)

I tried to fork() and exec() myself but still get the same PID's back.

The reason for all of this is that it is part of a larger perl/tk script
that is used to kick off a number of other scripts and each of those
scripts in turn run sqr statements from Sybase. I need to build in the
option to kill any of those queries in the event the user called the wrong
one (some take hours to run).

I posted a variation to this question a few weeks ago. Sorry if this is
repetition for anyone. 

I would very much appreciate any help and/or suggestions. I have tried
every way I can think of, I'm just about out of ideas. 

Thanks

Mike Shavel
mshavel@erols.com


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

Date: Thu, 16 Apr 1998 17:24:21 -0600
From: hackworth@brewtek.com
Subject: Re: Problem building perl on HPUX 10.20
Message-Id: <6h60ek$eq5$1@nnrp1.dejanews.com>

In article <6h4vu8$a49$1@camel19.mindspring.com>,
  "Scott" <sdh1@anchor.hotmail.com> wrote:
>
>
> Mark Frost wrote in message <3535170A.2DEB14F4@horizsys.com>...
> >I'm trying to build perl 5.004-04 using gcc 2.8.1 under HPUX 10.20.
> >Most of the compilation goes fine, but it ends up showing me:
> >
<snip snip>

> >    AutoSplitting perl library
> >AutoSplitting Text::ParseWords (lib/auto/Text/Parsewords)
> >/bin/sh: 7072 Memory fault(coredump)
> >make: *** [preplibrary] Error 139
> >
> >
> >It would appear that this is miniperl core dumping when trying to
> >autosplit lib/Text/ParseWords.pm.
> >
> >I was unable to find anything in the FAQ about this.  Has someone else
> >perhaps come across this problem?
> >
> >Thanks
> >
>
> Well, I just installed it 2 days ago on HP/UX 10.2 but with regular cc, and
> it compiled ok.  You might try switching compilers.
>
>   -Scott

As far as I can tell there is nobody to whom this has *not* happened.
I posted a question on this shortly after gcc 2.8.0 came out. I have
not had the time to fully debug it myself but I hear from someone else
every week or two that gets the identical problem with gcc 2.8.x + hpux
10.X + perl5.

It builds just dandy with either gcc 2.7.X or HP's $$$$ ANSI c
compiler so it's never been a high priority for me to fix.  I assume
in some version of gcc 2.8.? it will start working.  Until then unless
you are a hard core c++ programmer (I'm not...) I've seen no advantage
to gcc 2.8

Gary Rich
garyrich@smartlink.net

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


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

Date: Thu, 16 Apr 1998 22:55:49 GMT
From: tmornini@netcom.com (Tom Mornini)
Subject: rand($.) (was wc-l in Perl)
Message-Id: <tmorniniErJ3p1.Anp@netcom.com>

In a discussion about picking a random line from a file Tom Phoenix wrote:

>    open FILE, $name or die "Can't read '$name': $!";
>    while (<FILE>) {
>        $line = $_ if rand($.) <= 1;
>    }
>    print "One randomly-selected line is $line";

My question is: Why doesn't this hopelessly bias the randomness towards
the beginning of the file, when rand($.) would be more likely to be <= 1?

I ran it on a 112,000 line file over 100 iterations, and it seems that
it biases towards the end of the file, which also makes sense, since earlier
selections will be written over by later selections...

If fact, I don't believe this code even guarantees that a line is picked!

Was there a typo? I'd guess that I'm missing something here... :-)

-- Tom Mornini
-- InfoMania


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

Date: Thu, 16 Apr 1998 22:04:31 GMT
From: zolan@nwinfo.net (Jerry)
Subject: Server Side Include
Message-Id: <35367f97.3023569@news.nwinfo.net>

Is there any way to write one line in HTML that will run a PERL script
that just prints part of a web page?  I'm not interested in having the
entire page CGI..

E-Mail me if you have any insite.

Thanx in advance.


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

Date: Thu, 16 Apr 1998 18:48:06 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: Jerry <zolan@nwinfo.net>
Subject: Re: Server Side Include
Message-Id: <35368AA6.7DA7@juicepigs.com>

Jerry wrote:
> 
> Is there any way to write one line in HTML that will run a PERL script
> that just prints part of a web page?  I'm not interested in having the
> entire page CGI..

Let me beat Abigail to this one. This is an HTML question and has no
business being posted in clpm. 

try news:comp.infosystems.www.authoring.html

Yes, many in clpm can answer it but I'm sure that there are people in
rec.auto.ford that could too.

-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: Thu, 16 Apr 1998 15:33:41 -0800
From: ~arthur <star@sonic.net>
Subject: shorten array
Message-Id: <35369554.717E@sonic.net>

Hi,

I have a Perl program (thanks David Black) that picks a random word in a
game. If you play the game more than once in a row you may get the same
word. Is there a way that once the word is used it taken out of the
array?

~arthur
star@sonic.net


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

Date: 16 Apr 1998 23:24:58 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: shorten array
Message-Id: <6h640a$rgk$6@marina.cinenet.net>

~arthur (star@sonic.net) wrote:
: I have a Perl program (thanks David Black) that picks a random word in a
: game. If you play the game more than once in a row you may get the same
: word. Is there a way that once the word is used it taken out of the
: array?

You can do this using just an array, but I find it easier to write using 
a hash to do the dirty work:

  @allwords = qw(foo bar baz quux webo zep);
  @wordhash{@allwords} = @allwords;

  while (@words = keys %wordhash) {
    print "Current wordlist: @words\n";

    $pick = $words[rand(@words)];
    delete $wordhash{$pick};

    print "Picked word: $pick\n";
  }

If you run out of words in %wordhash, you can just repeat the hash slice 
assignment on line 2 to reinitialize it.  Note that the hash values are 
meaningless, so I just set them equal to the keys.

HTH!

---------------------------------------------------------------------
   |   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: 16 Apr 1998 15:57:31 -0700
From: Darryl Lee <lee@spam-me-not-darryl.com>
Subject: Wanna laugh?  (My First cgi.pm Script)
Message-Id: <notyou.892767261@shell3.ba.best.com>

Hi all...

Well, i went and took a crudely crafted plain ole perl CGI, and made
it into a crudely crafted cgi.pm CGI.

So...if you ski in Tahoe, or just want to laugh, check out:

http://www.darryl.com/tahoe/

http://www.darryl.com/tahoe/index.cgi.txt      <- latest script
http://www.darryl.com/tahoe/index.cgi.old.txt  <- original script

And why yes, this is a troll for pointers on optimizing my code.
Basically, i got it to run, and it's ugly as heck, and i'm JAPHW
(Just Another Perl Hacker Wannabe), but i'm willing to take my lumps
if you can teach me something.

So there.
-- 
Darryl Lee <lee@GOTSPAM?darryl.com> | Lame website: <http://www.darryl.com>

Thanks for the SPAM, Sanford.  Why don't _you_ have some? >:}
<domreg@cyberpromo.com> <domreg@cyberpromo.com> <domreg@cyberpromo.com>


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

Date: 16 Apr 1998 22:40:23 GMT
From: Art Cohen <upsetter@shore.net>
Subject: Re: Weird Truncate Behavior
Message-Id: <6h61cn$76e@fridge.shore.net>

Ronald J Kimball <rjk@coos.dartmouth.edu> wrote:
: Art Cohen wrote:
:> 
:> I still can't figure out what the original problem was, but I found it
:> works MUCH BETTER when I don't use the same token to represent two
:> different handles! ;) (boy is my face red)

: In that case, perhaps you were trying to truncate on a filehandle that you had
: opened for read.  Could that be the problem?

I think I was trying to truncate a filehandle that had already been closed
in a subroutine, actually (if anyone cares).

--Art

National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
        Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html



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

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

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