[11900] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5500 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 27 20:07:07 1999

Date: Tue, 27 Apr 99 17:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 27 Apr 1999     Volume: 8 Number: 5500

Today's topics:
        Apache mod_perl script won't exit on Apache::exit(); <steveb@web.co.nz>
    Re: autoincrement magic a..z (Abigail)
        building search engine trader4000@my-dejanews.com
    Re: building search engine (Greg Bacon)
    Re: can not find the simple.pm (Abigail)
    Re: CGI::Cookie (CPAN) (Abigail)
    Re: count associate array (Abigail)
        creating a static page <squeot@my-dejanews.com>
    Re: creating a static page (Greg Bacon)
    Re: creating a static page <cassell@mail.cor.epa.gov>
    Re: creating a static page <wyzelli@yahoo.com>
    Re: Extracting emails from array (Abigail)
    Re: FAQ 4.31: How do I pad a string with blanks or pad  (Larry Rosler)
    Re: FAQ 4.68: How do I handle binary data correctly? (Larry Rosler)
    Re: list of list (Abigail)
    Re: Module for drawing graphs hlsat@my-dejanews.com
    Re: On the fly conversion (Abigail)
    Re: Output from eval <dgris@moiraine.dimensional.com>
    Re: Output from eval (M.J.T. Guy)
    Re: problem with single quotes or abuse by programmer <ianb@zedat.fu-berlin.de>
    Re: question about guestbook <swarren@slip.net>
    Re: question from a newbie (Larry Rosler)
    Re: question from a newbie (Abigail)
        Script Help (JDDemme)
    Re: Server Overload (Bob Trieger)
    Re: Server Overload <camerond@mail.uca.edu>
    Re: Server Overload <cassell@mail.cor.epa.gov>
    Re: sorting Label values in popup_menu (Larry Rosler)
    Re: stupid single quote " wipes out REST OF TEXT NOSPAMcrstlblu@planet.eon.net
    Re: stupid single quote " wipes out REST OF TEXT NOSPAMcrstlblu@planet.eon.net
    Re: what's wrong with $x = $y or "" (Abigail)
    Re: Where do the spaces come from (Abigail)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 28 Apr 1999 11:19:13 +1200
From: Steve Baker <steveb@web.co.nz>
Subject: Apache mod_perl script won't exit on Apache::exit();
Message-Id: <372645F1.894FFB6E@web.co.nz>

I am running modperl on IRIX 6.5 with a persistant database
connection to Oracle 8 with the latest perl,  apache and openssl.

my scripts will usually not terminate when the end of the script
is reached.  Even with an exit(); or Apache::exit(); the browser will
keep on waiting for more data after the script has reached the end.
Maybe about 10% of the time, the script will exit correctly.

the following code:
print STDERR "the end";
Apache::exit();
print STDERR "you still here?";

will only print "the end".  

Any ideas?


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

Date: 27 Apr 1999 22:30:52 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: autoincrement magic a..z
Message-Id: <7g5dqs$1e4$2@client2.news.psi.net>

Ben Gilbert (bgilbert@sgi.com) wrote on MMLXV September MCMXCIII in
<URL:news:37255BFE.7A6D8B86@sgi.com>:
 .. 
 .. Actually, I looked at perlop and don't think the section on
 .. auto-decrement was well documented. It says: "The auto-decrement
 .. operator is not magical." Straight and to the point, but not detailed by
 .. any means. 
 .. 
 .. The section on auto-increment is pretty detailed, but it does not
 .. mention anything about incrementing using ascii values, that is why I
 .. asked. 
 .. 
 .. As to the second part of my question ... why doesn't it work in reverse?


Because the reverse isn't defined everywhere.

If I have:
    $foo = 'a0';
    $foo --;

What should $foo be?



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


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

Date: Tue, 27 Apr 1999 21:58:34 GMT
From: trader4000@my-dejanews.com
Subject: building search engine
Message-Id: <7g5bu7$jfb$1@nnrp1.dejanews.com>

could someone please tell me a simple way
of grabbing a page from a remote url
and saving it to a file.

i've been looking all day plz help,
                           thnx in advance,
                                       Mark_

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 27 Apr 1999 22:36:37 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: building search engine
Message-Id: <7g5e5l$jca$1@info2.uah.edu>

In article <7g5bu7$jfb$1@nnrp1.dejanews.com>,
	trader4000@my-dejanews.com writes:
: could someone please tell me a simple way
: of grabbing a page from a remote url
: and saving it to a file.

Take a look at the LWP::Simple module, available on the CPAN.

Greg
-- 
Today's agenda: Tug on Superman's cape, spit into wind, pull mask off Lone
Ranger, mess with Jim. 
    -- Ed Dravecky III


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

Date: 27 Apr 1999 22:36:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: can not find the simple.pm
Message-Id: <7g5e5s$1e4$3@client2.news.psi.net>

wendy1967@my-dejanews.com (wendy1967@my-dejanews.com) wrote on MMLXV
September MCMXCIII in <URL:news:7g50q4$8q5$1@nnrp1.dejanews.com>:
:: Hello,
:: 
::   My system administrator installed perl 5.00556 in our UNIX. I tried to
:: use LWP::Simple but got this error message.

Perl 5.00556 is a development release. There's no garantee it will work.
It might turn your computer into a flock of pink birds with fluffy red
feet. You are on your own. Do not run development releases in production
environments.

::   Could anybody help me with it?
:: 
:: Wendy
:: 
:: Content-type: text/html
:: 
:: <H1>Software error:</H1> <CODE>[Tue Apr 27 14:34:02 1999] Simple.pm: Can't
:: locate LWP/Simple.pm in @INC ( @INC contains:
:: /usr/local/lib/perl5/5.00556/sun4-solaris /usr/local/lib/perl5/5. 00556
:: /usr/local/lib/perl5/site_perl/5.00556/sun4-solaris /usr/local/lib/perl5/s
:: ite_perl/5.00556 .) at fetch.pl line 5. BEGIN failed--compilation aborted at
:: fetch.pl line 5. </CODE> <P>

That's HTML with a Perl error imbedded in it. That error is documented
in perldiag. Go read the man page.


Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


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

Date: 27 Apr 1999 22:37:54 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: CGI::Cookie (CPAN)
Message-Id: <7g5e82$1e4$4@client2.news.psi.net>

Donny Widjaja (donny@impulsesoftware.com) wrote on MMLXV September
MCMXCIII in <URL:news:3725EFC5.40BB474F@impulsesoftware.com>:
<> 
<> I try to fetch the expiration time from a cookie by using CGI::Cookie.


I just read the bottom of the box.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: 27 Apr 1999 22:41:19 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: count associate array
Message-Id: <7g5eef$1e4$5@client2.news.psi.net>

bing-du@tamu.edu (bing-du@tamu.edu) wrote on MMLXV September MCMXCIII in
<URL:news:7g4tvi$69n$1@nnrp1.dejanews.com>:
|| Hello there,
|| 
|| I know $#array+1 is the number of the elements of an array.  Is there any
|| ready-to-use operator or function to tell the element number of an associative
|| array?

        1 * keys %hash;

Unless you want to count keys and values separately, then it's

        2 * keys %hash;


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


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

Date: Tue, 27 Apr 1999 22:21:53 GMT
From: squeot <squeot@my-dejanews.com>
Subject: creating a static page
Message-Id: <7g5d9r$ktp$1@nnrp1.dejanews.com>

I need to create a static page by running a script whose original purpose was
to dynamically  create pages from a database.  The database only is updated
when certain triggers happen so the need to dynamically create pages is no
longer necessary. Does anyone have any ideas how to point the output to
overwrite an existing file when triggered?
thanks in advance.
TKS

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 27 Apr 1999 22:38:09 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: creating a static page
Message-Id: <7g5e8h$jca$2@info2.uah.edu>

In article <7g5d9r$ktp$1@nnrp1.dejanews.com>,
	squeot <squeot@my-dejanews.com> writes:
: I need to create a static page by running a script whose original purpose was
: to dynamically  create pages from a database.  The database only is updated
: when certain triggers happen so the need to dynamically create pages is no
: longer necessary. Does anyone have any ideas how to point the output to
: overwrite an existing file when triggered?

Reasonable shells allow you to redirect program output.  Most browsers
allow you to view and capture HTML source.

What is your Perl question?

Greg
-- 
People who comprehend a thing to its very depths rarely stay faithful to it
forever. For they have brought its depths into the light of day: and in the
depths there is always much that is unpleasant to see. 
    -- Nietzsche


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

Date: Tue, 27 Apr 1999 16:19:01 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: creating a static page
Message-Id: <372645E5.3A004E26@mail.cor.epa.gov>

squeot wrote:
> 
> I need to create a static page by running a script whose original purpose was
> to dynamically  create pages from a database.  The database only is updated
> when certain triggers happen so the need to dynamically create pages is no
> longer necessary. Does anyone have any ideas how to point the output to
> overwrite an existing file when triggered?
> thanks in advance.

This is a CGI question dressed in a llama's coat.

Translation: this is *not* a Perl question, and is not appropriate
to the newsgroup.  Even if some of your code is in Perl.  Perhaps you
should ask in comp.infosystems.www.authoring.cgi or a similar
newsgroup.  Or perhaps you want to read their FAQ first...

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Wed, 28 Apr 1999 08:56:16 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: creating a static page
Message-Id: <rIrV2.1$CT2.2293@vic.nntp.telstra.net>

squeot wrote in message <7g5d9r$ktp$1@nnrp1.dejanews.com>...
>I need to create a static page by running a script whose original purpose
was
>to dynamically  create pages from a database.  The database only is updated
>when certain triggers happen so the need to dynamically create pages is no
>longer necessary. Does anyone have any ideas how to point the output to
>overwrite an existing file when triggered?
>thanks in advance.
>TKS


Print the out put the the file handle which is set to the name of the file
you wish to update (replace).

You will need to include all the html code in the print output, and ensure
that the web server has permissions to replace the file in question.

Basically everything which was written to the dynamic page can be printed to
a file.

Here is an example using a 'here document'.

open(PAGE,'>drive:\path\filename.htm') or die("Error $! opening file");
 print PAGE<<HTML;
<HTML>
<HEAD>
<TITLE>HTML PAGE TITLE</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<body
link="yellow" alink="red" background="backgrnd.jpg" text=white>
<P ALIGN="CENTER"><B>
<img src="img.jpg">
<BR><br>
</FONT></P>
HTML

I will leave you to figure out what your html should really say!

Wyzelli




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

Date: 27 Apr 1999 22:23:23 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Extracting emails from array
Message-Id: <7g5dcr$1e4$1@client2.news.psi.net>

Bart Lateur (bart.lateur@skynet.be) wrote on MMLXV September MCMXCIII in
<URL:news:372662bf.1648079@news.skynet.be>:
$$ Randal L. Schwartz wrote:
$$ 
$$ >Do you dare exclude the CTO of a company that hasn't got a "nice clean
$$ >c-symbol@foo.bar.com" email address wanting to buy a bunch of your
$$ >stuff, but his email address is "pager:fred"@bob.big.com?
$$ 
$$ >Just do it right.  Remember that to the left of the "@" can be
$$ >ANYTHING and you won't go wrong.  Stop being so narrow minded.
$$ 
$$ Well, "pager:fred@bob.big.com" IS an illegal e-mail address.


Yes, but that isn't what Randal wrote, is it?



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


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

Date: Tue, 27 Apr 1999 16:02:13 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 4.31: How do I pad a string with blanks or pad a number with zeroes?
Message-Id: <MPG.118fe1d0c0abda5698995e@nntp.hpl.hp.com>

In article <MPG.118f68d14663a84998994a@nntp.hpl.hp.com> on Tue, 27 Apr 
1999 07:26:14 -0700, Larry Rosler <lr@hpl.hp.com> says...
 ...
> According to perlfunc, pack "A$pad_len" produces *trailing* padding 
> (i.e., right padding, hence left alignment).  The Perl documentation of 
> sprintf says that '-' "left-justifies within the field" (hence right 
> padding).  I don't have my C Standard at hand, but IIRC, the term used 
> there is left alignment.

FWIW, here's the stuff from C:


If the converted value has fewer characters than the width, it will be 
padded with spaces (by default) on the left (or right, if the left 
adjustment flag, described later, has been given) to the field width.
 ...
'-'  The result of the conversion will be left-justified within the 
field.  (It will be right-justified if this flag is not specified.)


So there is historical support for 'left or right padding', and for 
'left- or right-justified', but not for 'alignment'.

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


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

Date: Tue, 27 Apr 1999 15:13:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 4.68: How do I handle binary data correctly?
Message-Id: <MPG.118fd6467657a6f398995b@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37262cff@cs.colorado.edu> on 27 Apr 1999 15:32:47 -0700, Tom 
Christiansen <perlfaq-suggestions@perl.com> says...
 ... 
>     On some legacy systems

which now operate perhaps 95% of the world's computers...

>                           , however, you have to play tedious games
>     with "text" versus "binary" files. See the section on "binmode" in
>     the perlfunc manpage, or the upcoming the perlopentut manpage
>     manpage.

ITYM 'the the perlopentut perlopentut manpage manpage'.  :-)

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


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

Date: 27 Apr 1999 23:07:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: list of list
Message-Id: <7g5fuv$1hi$1@client2.news.psi.net>

Sheila  Eugenio (seugenio@man.amis.com) wrote on MMLXV September MCMXCIII
in <URL:news:01be9067$1bec8830$2bbe10ac@amipnet>:
<> Hi everyone!
<> 	I have a list of list as a result of fetchall_arrayref fetch  in DBI. My
<> problem is I want to compute the average (1st col) and sum(2nd col)  of
<> every 2 rows.  Ex.
<> @array = (
<> 	     ["34668", "637299"],
<> 	     ["67290", "620574"],
<> 	     [ "97331", "620574"],
<> 	     ["102327", "564416"],
<> 	     ) 
<> 	I already have a script but my looping doesn't work the way I want it. It
<> computed for the sum & avg of all 4 rows. I know there's an easier and
<> better way to do it. Thanks for all the help!
<> 


Yes, I have a script that's easier and better. But since you don't
show any code, I won't show you any either. 


Abigail
-- 
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split  # For Sun
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"  # Solaris


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

Date: Tue, 27 Apr 1999 23:33:56 GMT
From: hlsat@my-dejanews.com
Subject: Re: Module for drawing graphs
Message-Id: <7g5hh4$on6$1@nnrp1.dejanews.com>

In article <7flgqh$4nk$3@info2.uah.edu>,
  Greg Bacon <gbacon@cs.uah.edu> wrote:
> In article <7fle0n$qdv$1@nnrp1.dejanews.com>,
> 	billy_collins@my-dejanews.com writes:
> : I am looking for a module that can help me draw bar and line graphs on the
> : web, based on my database (which is on the server).
>
> Search the CPAN modules list:
>
>     <URL:http://www.perl.com/CPAN/modules/01modules.index.html>
>
> Greg
> --
> Those who do not understand UNIX are condemned to reinvent it -- badly.
>     -- Henry Spencer
>
I used this  for bar graph and this is pretty cool.
http://mkruse.netexpress.net/perl/index.html

Satheesh


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 27 Apr 1999 23:09:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: On the fly conversion
Message-Id: <7g5g3u$1hi$2@client2.news.psi.net>

Ashley M. Kirchner (ashley@pcraft.com) wrote on MMLXV September MCMXCIII
in <URL:news:3725F3FB.5EFC6447@pcraft.com>:
@@ 
@@ 
@@     I have a complete web site which is build using SSI's on all of its
@@ pages.  What I'd like to do is build a perl script that once passed one
@@ of these .shtml files, it'll do some tag stripping and present the same
@@ page again, will less bells and whistles...


lynx -dump http://your.site/your.page > output.



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: 27 Apr 1999 16:41:14 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Output from eval
Message-Id: <m3d80padpx.fsf@moiraine.dimensional.com>

homelessinseattle@my-dejanews.com writes:

> 2.try using using "select" to output to a different filehandle or
> 3.put a "| $error=$!;" after the commands you are trying to capture.

That sure looks like normal english, but I've no idea why you
think (2) has anything to do with the question (it doesn't) and
(3) makes absolutely no sense.  Perhaps you should try writing
some code, testing it, and then posting that as an answer instead.

> (P.S, there was no number "1." I like to start with "2.")

<note to=self>
 People count from 0.  
 Users count from 1.  
 The clueless count from 2.
</note>

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 27 Apr 1999 23:03:27 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Output from eval
Message-Id: <7g5fnv$qav$1@pegasus.csx.cam.ac.uk>

Linda Littleton <xxx@psu.edu> wrote:
>When I run the following code (where eval is evaluating something with a
>syntax error), an error message is getting printed to the screen. What I
>want is to capture all of the messages so that I can then handle the
>situation in a different way. How do I keep eval from writing out this
>stuff?
>
>  $calc = '5)8(';
>  local ($ans) = eval $calc;
>  print "Calc:   $calc\n";
>  print "Error:  $@\n" if ($@);
>  print "Answer: $ans\n";

You need to understand that many errors in parsing are delivered as 
warnings rather than as hard errors, so they don't turn up in $@.
Dealing with this is messy, but  perldoc -f eval  offers this hint:

If there is a syntax error or runtime error, or a C<die()> statement is
executed, an undefined value is returned by C<eval()>, and C<$@> is set to the
error message.  If there was no error, C<$@> is guaranteed to be a null
string.  Beware that using C<eval()> neither silences perl from printing
warnings to STDERR, nor does it stuff the text of warning messages into C<$@>.
To do either of those, you have to use the C<$SIG{__WARN__}> facility.  See
L</warn> and L<perlvar>.


But that is slightly misleading.  There are error conditions that are
*only* reported as warnings, so eval() returns undef, but $@ is the
null string.   Offhand, I can't remember an example, but I do remember
being very sore when it bit me.


Mike Guy


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

Date: Wed, 28 Apr 1999 00:40:32 +0200
From: Ian Berwick <ianb@zedat.fu-berlin.de>
Subject: Re: problem with single quotes or abuse by programmer
Message-Id: <Pine.SGI.3.96.990428001002.18533A-100000@Komma.ZEDAT.FU-Berlin.DE>

On Tue, 27 Apr 1999, Larry Rosler wrote:

> [Posted and a courtesy copy mailed.]
> 
> In article <7g56mu$df$1@gellyfish.btinternet.com> on 27 Apr 1999 
> 20:29:18 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
> ...
> >           The whole thing gets sodded up when you
> > go to the command interpreter because of the stupid decision to use the /
> > as the 'Switch Char' and the strange way the interpreter parses its input
> 
> This / => \ and - => / is all part of the "MS-DOS's Not UNIX(TM)" [that 
> would be a nice acronym -- MNU :-] syndrome of about 1980.  It may go 
> back all the way to CP/M, but I doubt it.

Ahh, a blast from the past. Brings it all flooding back. My first,
faltering programming steps in Z-80 assembler running under CP/M...

It's nigh upon 15 years since I last set hands on a CP/M beast, but  
I vaguely remember the transition to DOS going very smoothly, as the
command line business was remarkably similar. I don't think  CP/M had
backslashes because it didn't support subdirectories, but everything else
had a lot in common with MS-DOS (or the other way round). I had more
trouble going from MS-DOS to UNIX...

If my memory hasn't failed me completely, MS-DOS (aka Quick & Dirty
Operating System or something like that before it passed into the hands
of one W. Gates) was in its original incarnation not a lot more than a
CP/M port for the original IBM PC. MS-DOS's file handling took a lot from
CP/M, and even went as far as emulating CP/M function calls (IIRC MS-DOS's
first ten or so INT 21h calls are virtually identical to the corresponding
CP/M system calls).

Maybe that helps a little, although my ageing memory would appreciate any
factual corrections ;-)
Now I'll go and have a little lie down and reminisce about the old times,
when mice were creatures behind the skirting board, windows were made from
glass, 3.5 Mhz clock speed, 64k RAM, floppy floppies, mutter mutter...

Ian Berwick





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

Date: Tue, 27 Apr 1999 22:57:09 GMT
From: "Stephen Warren" <swarren@slip.net>
Subject: Re: question about guestbook
Message-Id: <9hrV2.3752$gv5.1997@news.rdc1.sfba.home.com>

Your problem probably comes from wherever FORM is initialized. That would be
more useful code to show.

A style note:

I assume that &no_name is meant to just send back the same form to fill in.
I assume that the form generation code is shared between whatever originally
generated it and all your no_xxx functions? You might also consider using
'here documents' to increase your code's readability.

S.L. de Vries <devries-devries@wxs.nl> wrote in message
news:3725AC9E.896558B4@wxs.nl...
> This is the form in 'add.html':
>
>       <FORM METHOD="POST"
> ACTION="http://home.fiberia.com/sjoonvc/guest.cgi">
>      <TR><TD><B>Naam:</B></TD><TD><INPUT TYPE=TEXT NAME=name
> SIZE=60></TD></TR>
>      <TR><TD><B>E-Mail:</B></TD><TD><INPUT TYPE=TEXT NAME=email
> SIZE=60></TD></TR>
>      <TR><TD><B>URL:</B></TD><TD><INPUT TYPE=TEXT NAME=url VALUE=http://
> SIZE=60></TD></TR>
>      <TR><TD><B>Woonplaats:</B></TD><TD><INPUT TYPE=TEXT NAME=city
SIZE=15>
> <B>Provincie:</B><INPUT TYPE=TEXT NAME=state SIZE=8>
>          &nbsp;&nbsp;&nbsp;&nbsp;<B>Land:</B><INPUT TYPE=TEXT NAME=country
> VALUE=Netherlands SIZE=10></TR>
>      <TR><TD VALIGN=top><B>Tekst:</B></TD><TD><TEXTAREA NAME=comments
> COLS=51 ROWS=8></TEXTAREA></TD></TR>
>      <TR><TD>&nbsp;&nbsp;</TD><TD></TD></TR>
>      <TR><TD></TD><TD><INPUT TYPE=image SRC="graphics/add.gif"
> BORDER=no></TD></TR>
>     </table>
>     </FORM>
>
> Here are a few lines of the script:
>
> #Checks to see that the comments, name and e-mail address were added!
> &no_name unless $FORM{'name'};
> &no_comments unless $FORM{'comments'};
> &no_email unless $FORM{'email'};
>
> sub no_name {
>    print "Content-type: text/html\n\n";
>    print "<HTML>\n";
>    print "<TITLE>No Name</TITLE>\n";
>    print "<BODY BGCOLOR=#FFFFFF>\n";
>    print "<CENTER><IMG SRC=\"$base$gif2\"></CENTER><BR>\n";
>    print "You forgot to fill in your Name. We need this in order to\n";
>    print "process your entry. Please add your name in the blank
> below.<p>\n";
>    print "<TABLE  CELLSPACING=3 CELLPADDING=2>\n";
>    print "<FORM METHOD=POST ACTION=\"$cgi\">\n";
>    print "<TR><TD><B>Name:</B></TD><TD><INPUT TYPE=TEXT NAME=\"name\" ";
>    print "SIZE=50></TD></TR>\n";
> <cut>
>
> When you fill in the whole guestbook, you get an error that you didn't
fill
> in your name.
>




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

Date: Tue, 27 Apr 1999 15:17:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: question from a newbie
Message-Id: <MPG.118fd74b2082092f98995c@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7g5agr$i60$1@nnrp1.dejanews.com> on Tue, 27 Apr 1999 
21:34:19 GMT, homeless <homelessinseattle@my-dejanews.com> says...
> In article <7g3iu7$vkp$1@nnrp1.dejanews.com>,
>   slash_ben@my-dejanews.com wrote:
> > how can I print just two lines and all the lines in between them in a file?
> 
> here's a cheap-sleazy way of doing somthing of the sort, ben.
 ...
>      {$flagset=1;}
 ...
> or something.

Or something else.  Flags are foul.  Write this program in Perl, using 
the scalar range operator as suggested by others.

>   homeless in seattle,
>     "If it's not coffee-stained, it's not official."
>      MySisterHasLice@homelessinseattle.com
> --
>   homeless in seattle,
>     "If it's not coffee-stained, it's not official."
> 
>      MySisterHasLice@homelessinseattle.com
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

And PLEASE do something about this sig.  A space after the two dashes 
would be a good start.  Not repeating it in the text would be good also.

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


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

Date: 27 Apr 1999 23:15:43 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: question from a newbie
Message-Id: <7g5gev$1hi$3@client2.news.psi.net>

slash_ben@my-dejanews.com (slash_ben@my-dejanews.com) wrote on MMLXV
September MCMXCIII in <URL:news:7g3iu7$vkp$1@nnrp1.dejanews.com>:
## how can I print just two lines and all the lines in between them in a file?

To print lines 17 to 84, inclusive:

        perl -nlwe 'print if 17 .. 84' file


To print lines starting with a line containing BEGIN, and ending with END:

        perl -nlwe 'print if /BEGIN/ .. /END/' file


See perlrun and perlop (for ..)



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: Tue, 27 Apr 1999 23:40:25 GMT
From: jddemme@technologist.com (JDDemme)
Subject: Script Help
Message-Id: <7g5hti$jtb$1@bgtnsc03.worldnet.att.net>
Keywords: help newbie dir directory listing i/o

I'm working on a script o control what the user sees when the site lists the 
midis in a directory. each midi has a
file called (filename of midi).txt. The first line of the midi is the name of 
the song, and the second line is the
author. those are the only important lines here, for now. Here's the script. 
If speaks for itself. oh, and, top.txt is
the html for the page up to the point where the data should be inserted.

THANKS!!
JDDemme
jddemme@technologist.com



#!/usr/bin/perl
$DR = $ENV{'QUERY_STRING'};
  opendir(DIR, $DR);
  @files = grep(/\.mid$/,readdir(DIR));
  closedir(DIR);
  $mid = $files[0];
  open(mid,"$DR/$mid.txt);
  $name = <mid>;
  $artist = <mid>;
  close(mid);
        
print "Content-type:text/html\n\n";
open(top,"top.txt");
@top = <top>;
close(top)
foreach $tp (@top){
  chomp($tp);
  print "$tp\n";
}

print "<big><big>MIDIS For: $artist</big></big><BR><BR><BR>\n";
  foreach $mid (@files) {
        open(mid,"$DR/$mid.txt);
        $name = <mid>;
        $mid = "<a href=\"data.cgi?$DR/$mid.txt\">$name</A><br>\n";
        close(mid)
  foreach $fe (@files) {
     print "$fe";
  }

print <<EndBot;

  <p>&nbsp;</p>
</div>
</body>
</html>

EndBot
;


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

Date: Tue, 27 Apr 1999 22:11:03 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Server Overload
Message-Id: <7g5c50$nbt$1@birch.prod.itd.earthlink.net>

"JJ" <webdude@mcminn.net> wrote:
>I recieved this message from my ISP and was wondering if any of you guru's
>can help me figure out what the cause is.
>
>This script was running about 15 copies on our web server machine
>since around 7:00pm last night, causing excessive load.  Please
>take the script out of production or set some limits so this does not
>happen.
>
>Thanks,
> It appears to me he is referring to the fact that the script is not
>stopping after it is executed resulting in multiple instances of the script
>being open and staying open. Anyone have any ideas?


Try putting this before the meat of your script:

#!/usr/local/bin/perl -w
use strict;
use PSI::ESP qw( gonna_zombie sys_admin_will_yell );
exit(666) if ((&gonna_zombie >= 15) or (&sys_admin_will_yell == 1));


PS. I didn't test this before posting.

Good luck,



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

Date: Tue, 27 Apr 1999 17:28:10 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Server Overload
Message-Id: <372639FA.57B4BE12@mail.uca.edu>

JJ wrote:
> 
> I recieved this message from my ISP and was wondering if any of you guru's
> can help me figure out what the cause is.
> 
> This script was running about 15 copies on our web server machine
> since around 7:00pm last night, causing excessive load.  Please
> take the script out of production or set some limits so this does not
> happen.
> 
> Thanks,
>  It appears to me he is referring to the fact that the script is not
> stopping after it is executed resulting in multiple instances of the script
> being open and staying open. 

It appears to me that your script invoked Xerox::Machine and was making
unauthorized duplicates of itself. You should set it down and give it a
good talking to, maybe sit it in the corner for a millenium or so. You
don't want the server to get a hernia.

> Anyone have any ideas?

I had an idea for a good business, once. It occurred to me that if you
could take all of these keyboard/TV set thingies which seem to be on
everybody's desk so they can play Solitaire and hook them together, that
you could make money by charging the people to talk to each other. But
then I noticed that someone else already did that. 

Let's see, I cannot spell "perl" in less than 6 words in your message:
"sto_p_ping aft_er_ it is executed resu_l_ting" thus this does not make
(IMHO) a Perl question. Bye.

Cameron

-- 
Cameron Dorey
camerond@mail.uca.edu


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

Date: Tue, 27 Apr 1999 16:11:29 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Server Overload
Message-Id: <37264421.2C11F67@mail.cor.epa.gov>

JJ wrote:
> 
> I recieved this message from my ISP and was wondering if any of you guru's
> can help me figure out what the cause is.

Only gurus and programmers here.  No psychics.  But then, we don't
charge $10 a minute to your credit card to talk to us on the phone.

> This script was running about 15 copies on our web server machine
> since around 7:00pm last night, causing excessive load.  Please
> take the script out of production or set some limits so this does not
> happen.
> 
> Thanks,

>  It appears to me he is referring to the fact that the script is not
> stopping after it is executed resulting in multiple instances of the script
> being open and staying open. Anyone have any ideas?

It appears to me that you have a problem with your web script.

Using the PSI::ESP module, I divine that oyu have some Perl in it
somewhere...  And you think the Perl part might be the problem...
Let me see...  But you don't really know...

Why is your script spawning off copies of itself, when you don't
know how to monitor or control said copies?  This sounds like 
A Bad Thing.

And how do you expect anyone to diagnose your problem, when you 
haven't given any useful information, other than the fact that your
ISP now hates you?

Since you didn't munge your e-mail address, you should get an
extremely helpful e-mail from gnat.  Use every bit of advice in
that e-mail.  If you can replicate the problem in less than 30 
or 40 lines of Perl code, feel free to post the code and ask 
us for help.

-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Tue, 27 Apr 1999 15:31:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: sorting Label values in popup_menu
Message-Id: <MPG.118fdab0168f99e498995d@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

SEE THAT ABOVE?  It's what you should do when you send a copy to 
someone, so they don't think it is a private email and respond 
accordingly, then have to do it over again.  Good newsreaders make this 
very easy.  Invest in one instead of using that f...ing browser.

In article <372627CA.5DF25DD3@ntwrks.com> on Tue, 27 Apr 1999 17:10:34 -
0400, Sushant Gargya <sushant@ntwrks.com> says...
> Thanks for the response, Larry.
> I double checked the max. characters/line within the browser and it is
> set to 72......

123456789012345678901234567890123456789012345678901234567890123456789012

Yes.  So what are these partial lines (see below)?

> Regarding sorting hash......I'm familiar with sorting hash,but forsome
> reason the sort
> does not seem to work when I try.....Here's the kinda stuff I've tried:
>                 $users = $query->popup_menu(-name=>'mID',
>                  -values=>\@mList,
>                  -labels=>(sort values(%mNames));
> -------------------------------------------------
>                 $users = $query->popup_menu(-name=>'mID',
>                  -values=>\@mList,
>                  -labels=>(sort { $mNames{$a}<=>$mNames{$b} }
> (%mNames));
> Could you send me a 4-liner code that would work.....

I would insert the function 'keys' ahead of the name of the hash in your 
second example.  I don't know what the rest of the stuff does, but that 
will give you a list of the keys of the hash sorted by their (numeric) 
values.

> Thanks again for taking time to respond.

Glad to help.  Next time, don't change the title gratuitously, so the 
thread stays together (in a proper newsreader, that is)

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


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

Date: Tue, 27 Apr 1999 23:43:30 GMT
From: NOSPAMcrstlblu@planet.eon.net
Subject: Re: stupid single quote " wipes out REST OF TEXT
Message-Id: <371b1617.1544326@news.planet.eon.net>

On Tue, 27 Apr 1999 10:13:46 -0700, David Cassell <cassell@mail.cor.epa.gov>
wrote:
>NOSPAMcrstlblu@planet.eon.net wrote:
>> I've got this mysterious problem with a crummy " quotation mark,
>> in my flatfile dbm database, I have several lines of text which have a crummy
>> quotation mark in them (5'10") to be exact,... the 5'10" appears right smack in
>> the middle of the text,....
>
>Tad already gave you the crucial information.  But I noticed this:
>
>> strange, I've tried various things with the (=~tr/"//;), (=~tr/\"//;) and so on
>> to no avail,... any suggestions?
>You need to look up tr/// in the perlop manpage.  Use `man' or
>`perldoc' or the html docs, or whatever you like.
>The important point:
>tr/"// does *not* delete those quotes for you!  It only counts them.
>If you want to get rid of them, you need to do this:
> 
>   $varname =~ tr/"//d;
>
>And backwhacking the " won't help either.  That's not how tr///
>works.
>
>> sorry to bother you
>
>It's okay.  We wouldn't be answering questions in this ng if we
>didn't want to help.  But your problem really is an HTML problem
>dressed up in a llama's coat.
>David

	thanks Dave, I'll try it, but i still don't see why everyone thinks this
is a HTML problem????

	the first CGI GENERATED script opens a DBM file, and a variable gets
declared something like:
	$thetext = $dbhash{$fields{'thedbkey'}};
$thetext now contains a textstring of...   I am 5'10" tall
and prints to the browser on a cgi gen'd page PERFECTLY!

if THIS SCRIPT also printed a NEW FORM under that with a hidden field like
	<input type=\"hidden\" name=\"whatever\" value=\"$thetext\">

once SUBMITTED, the NEXT script parses, and prints to the browser
	print "the value of the text field is $fields{'whatever'}\n";

both the SINGLE QUOTE, as well as EVERYTHING AFTER IT gets lost.
I don't understand how this is a html problem, sounds more like a parseing
problem to me???? but hey, I've only been at this 4 months  :)

wj
remove "SPAM" from email to reply :)


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

Date: Tue, 27 Apr 1999 23:58:07 GMT
From: NOSPAMcrstlblu@planet.eon.net
Subject: Re: stupid single quote " wipes out REST OF TEXT
Message-Id: <371b1da9.3482619@news.planet.eon.net>

On Tue, 27 Apr 1999 10:13:46 -0700, David Cassell <cassell@mail.cor.epa.gov>
wrote:
>NOSPAMcrstlblu@planet.eon.net wrote:
>> quotation mark in them (5'10") to be exact,... the 5'10" appears right smack in
>> the middle of the text,....
>
>Tad already gave you the crucial information.  But I noticed this:
>> strange, I've tried various things with the (=~tr/"//;), (=~tr/\"//;) and so on
>> to no avail,... any suggestions?
>
>You need to look up tr/// in the perlop manpage.  Use `man' or
>`perldoc' or the html docs, or whatever you like.
>If you want to get rid of them, you need to do this:
> 
>   $varname =~ tr/"//d;
>David

	thanks Dave, I tried it, and it didn't work either???
the text string is about 400 characters long, it was passed into the next SCRIPT
by the post method, was parsed, and the single quote is right smack in the
middle of the VALUE OF it  :)

	I still lose BOTH the single quote, as well as the 200 characters AFTER
the single quote  :)

wj
remove SPAM from email to reply



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

Date: 27 Apr 1999 23:23:24 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: what's wrong with $x = $y or ""
Message-Id: <7g5gtc$1hi$4@client2.news.psi.net>

renenyffenegger@my-dejanews.com (renenyffenegger@my-dejanews.com) wrote
on MMLXV September MCMXCIII in <URL:news:7g3rmk$7mp$1@nnrp1.dejanews.com>:
"" Hi
"" 
"" I intend to assigne the value of $y to $x (if $y is defined)
"" or the empty string (otherwise).
"" 
"" So, I thought I'd be a good idea to go with
"" $x = $y or "";
"" Not so perl, saying: Useless use of constant in void context at....
"" 
"" So what's wrong with that and how can I have a shorter version than
"" the hated
"" $x = $y if defined $y;
"" $x = "" unless defined $y;


What's is the precedence, "or" has a lower one than "=". On purpose.
"||" however has a higher precedence. $x = $y || ""; works 'fine'.

However, it is *NOT* equivalent with
   $x = $y if defined $y;
   $x = "" unless defined $y;

as there are many things in Perl that are false. "", 0, '0' and undef are
all false, but only undef isn't defined.

You can use:
   $x = defined $y ? $y : "";


Now if only we had the ?? operator....



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: 27 Apr 1999 23:25:59 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Where do the spaces come from
Message-Id: <7g5h27$1hi$5@client2.news.psi.net>

John T. Drefke (jtdrefke@gte.net) wrote on MMLXV September MCMXCIII in
<URL:news:P1gV2.3449$B55.276363@dfiatx1-snr1>:
## I know how to get my program to work but I also like
## to understand what is really going on behind door number 1.
## 
## I have a file called a.dat which contains:
## aa
## aa
## aa
## 
## Perl code:
## open(f,"<a.dat");
## @x=<f>;
## print "@x";
## 
## Prints:
## aa
##  aa
##  aa


Of course. Read perlvar about $". And compare 'print @x;' vs 'print "@x";'.



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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