[12946] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 356 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 3 21:17:21 1999

Date: Tue, 3 Aug 1999 18:10:14 -0700 (PDT)
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, 3 Aug 1999     Volume: 9 Number: 356

Today's topics:
    Re: Need Help Understanding a perl script (Martien Verbruggen)
    Re: OPEN3() Function (elephant)
    Re: Perl Begineer Question... (Abigail)
    Re: perl problem with associative array (David H. Adler)
    Re: Quoting Strategies and the Jeopardy Game (Marc Haber)
    Re: Read the FAQs:  CGI/Perl question (Martien Verbruggen)
    Re: Read the FAQs: CGI/Perl question <makarand_kulkarni@my-deja.com>
    Re: select-based networking <uri@sysarch.com>
    Re: strange error <makarand_kulkarni@my-deja.com>
    Re: Talking to a ksh script <makarand_kulkarni@my-deja.com>
    Re: Talking to a ksh script (Martien Verbruggen)
    Re: tar (Abigail)
        using perlcc <henryf@sminter.com.ar>
    Re: Why no Perl books at Fry's? (Abigail)
    Re: Why no Perl books at Fry's? (Abigail)
    Re: Working Telnet Script Needed (elephant)
    Re: Working Telnet Script Needed <carvdawg@patriot.net>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Wed, 04 Aug 1999 00:44:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Need Help Understanding a perl script
Message-Id: <F1Mp3.129$m62.6115@nsw.nnrp.telstra.net>

In article <rqegvaoar4fcq6@corp.supernews.com>,
	"Diane" <tech1@magicnet.net> writes:

> Excellent! Here is the script. I understand the Print commands, and all the
> HTML outputs, what Id like some explanation on are the loops and variables
> and all the other lines that are not obvious...including how it sets up and
> loads the array of values..

The script you posted is a bit buggy, and does some odd things. It
reinvents the wheel, and does so incorrectly in some cases. it also
does not provide you with the full environment. It also skips one
command line argument (even though command line arguments are normally
not really part of the CGI specification) It also uses print
statements excessively, while a here-doc syntax would do better.

Suggest to fix it this way:

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

use CGI qw(:standard);

print header;

print <<EO_HEADER;
<HEAD>
<TITLE>Show CGI Inputs</TITLE>
</HEAD>
<BODY>
<h1>Show CGI Inputs:</h1><hr>
<h2>Command Line Arguments:</h2>
EO_HEADER

# Command line arguments? For a CGI script? Oh well..
# Don't skip the first argument, like your code does:
foreach my $i ( 0 .. $#ARGV ) { print "arg$i: $ARGV[$i]<BR>\n" }

print "<HR><h2>Environment Variables:</h2>\n";
foreach my $env (keys %ENV) { print "$env = $ENV{$env}<BR>\n" }

print "<HR><h2>All submitted name/value pairs</h2>\n";
print dump();


If you really need the name/value pairs split up by POST/GET, encoded,
decoded, I suspect the CGI module will let you do so. I would normally
not bother.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd.       | excuse - Lazarus Long
NSW, Australia                      | 


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

Date: Wed, 4 Aug 1999 10:16:02 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: OPEN3() Function
Message-Id: <MPG.1212314e15ce9fdf989bd4@news-server>

Greg Guerin writes ..
>I found out the open3 function may be able to help me with bidirectional
>communication between a ksh script being executed from w/in a perl
>script, but I can find very little documentation on it in the Perl books
>that I have.  Does anyone know where I can find information on the open3
>function or have a sample of code that uses it?  Thanks in advance.

do a search through recent newsgroup postings from me .. you will find a 
hacked up example of using either open3 in response to someone else's 
question .. this may be a place to start .. but I'm no expert and don't 
know of any other documentation

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 3 Aug 1999 18:16:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl Begineer Question...
Message-Id: <slrn7qeu1e.s67.abigail@alexandra.delanet.com>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCLXIII
September MCMXCIII in <URL:news:7o6q8d$acj$1@lublin.zrz.tu-berlin.de>:
@@ Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:
@@ >Jimmy (c6635500@comp.polyu.edu.hk) wrote on MMCLXIII September MCMXCIII
@@ 
@@ >x
@@ 
@@ This must be one of your terser replies.


No, it only looks like it. But that's just because you always ignore
my 0 byte followups.



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


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 3 Aug 1999 23:40:22 GMT
From: dha@panix7.panix.com (David H. Adler)
Subject: Re: perl problem with associative array
Message-Id: <slrn7qevev.9cv.dha@panix7.panix.com>

In article <7o67n1$2im$1@nnrp1.deja.com>, superba77@my-deja.com wrote:

>- I've created an associative array:
>
>%thumbswidth =
>("up1",64,"up88",68,"up87",80,"up85",52,"up79",72,"up75",72,"up63",128,"
>up52",56,"up4",76,"up34",64,"up21",104,"up17",52,"up14",48,"up13",128,"u
>p10",72);
>
>- Then in a loop I wanted to call this array:
>
>$actimgw = $thumbswidth{'$elementname'};

Here, because you are using single quotes, $elementname is being
treated like a literal string.

>   or I also tried:
>$actimgw = $thumbswidth{$elementname};

This worked for me.  Perhaps you have a version of perl where this
doesn't work for some reason... *shrug*.

Good luck,

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"I'll keep him as an insurance policy, since, unfortunately, I can't
kill him twice." - Scaroth


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

Date: Wed, 04 Aug 1999 00:16:00 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Quoting Strategies and the Jeopardy Game
Message-Id: <7o80o1$n8q$1@news.rz.uni-karlsruhe.de>

Tom Christiansen <tchrist@mox.perl.com> wrote:
>Sigh.  Ok, thrice weekly is remains then.

May I ask to include the date of the last change to the document in
the subject? Makes it easier to killfile for users but keeps the
filter from killing away a new release of the document.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: Wed, 04 Aug 1999 00:19:38 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Read the FAQs:  CGI/Perl question
Message-Id: <uGLp3.90$m62.5124@nsw.nnrp.telstra.net>

In article <37a772e1.614743824@news1.cal.metronet.ca>,
	jimhutchison@metronet.ca (Jim Hutchison) writes:
> I've a perl script that grabs data from a very large file, and parses
> it for GD graphing as well as text presentation.  The beginning of the
> script has some text telling the user to wait till the report is
> generated, however nothing displays till the entire script is
> finished.

buffering.. Look up the variable $| in the perlvar documentation.

> My korn shell version of this job is much slower, but it DOES
> initially display the comfort message right away, then continues to
> execute the other instructions.

scripts buffer differently.

> Any ideas?  I'm running this on Apache.

Ah. Is this a CGI script? Even though your subject mentiones CGI, you
should really say so in the body of your message. It probably still is
a buffering issue, but now it's become a buffering issue of perl, your
HTTP server and the wat CGI is implemented. And how 'HTML' is
displayed in various browsers. Depending on what exactly is causing
your text not to show up immediately, it could be any of the above.
Try the $| variable. If that doesn't help, ask this question again in
one of the groups that deals with CGI.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Think of the average person. Half of
Commercial Dynamics Pty. Ltd.       | the people out there are dumber.
NSW, Australia                      | 


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

Date: Wed, 04 Aug 1999 00:00:15 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: Read the FAQs: CGI/Perl question
Message-Id: <7o7vqa$bpp$1@nnrp1.deja.com>



>however nothing displays till the entire script is

try using
$|++;
to flush STDOUT before you start generating your dynamic page.
--


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 03 Aug 1999 19:45:55 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: select-based networking
Message-Id: <x71zdkl96z.fsf@home.sysarch.com>

>>>>> "REL" == Roger Espel Llima <espel@iagora.com> writes:

  REL> Is there some module that implement a select() inner loop, where you
  REL> register IO::Socket objects with associated \&callbacks, and it does the
  REL> work of select()ing and line buffering for you?

Event.pm

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: Tue, 03 Aug 1999 23:56:29 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: strange error
Message-Id: <7o7vj8$bn7$1@nnrp1.deja.com>


> Have a program with perfectly matched brackets, quotes, etc.

Make sure you do not have braces/brackets on the comment lines.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 04 Aug 1999 00:10:36 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: Talking to a ksh script
Message-Id: <7o80dl$c7e$1@nnrp1.deja.com>

[ you tried..]

> print WRITE "y";
> print WRITE "n";

If you were interacting with the script
you would be entering "y" and hitting Enter
So I think you need to try  --

print WRITE "y\n" ;

I may be wrong.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 04 Aug 1999 00:22:52 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Talking to a ksh script
Message-Id: <wJLp3.97$m62.5124@nsw.nnrp.telstra.net>

In article <37A77394.CD30D556@hp.com>,
	Greg Guerin <gregory_guerin@hp.com> writes:

> I wrote the following code to try to answer several different questions
> that the test.ksh script prompts with.  The first answer works fine but
> the second doesn't receive the WRITE string 'n'.  There are more than
> two questions but I am just trying to get past # 2 right now.  Any
> suggestions would be appreciated!

[snip]

> $pid = open2(\*READ, \*WRITE, "test.ksh");

You should really check the return value of this. Just to make sure
that it succeeded.

> print WRITE "y";
> print WRITE "n";

I suspect that your script does not just expect a 'y' and a 'n', but
rather those letters followed by a newline. Try:

print WRITE "y\n";
print WRITE "n\n";

> mailto: gregory_guerin@hp.com

No need to repeat that. Your From: field already contains this
address.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | You can't have everything, where would
Commercial Dynamics Pty. Ltd.       | you put it?
NSW, Australia                      | 


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

Date: 3 Aug 1999 19:54:10 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: tar
Message-Id: <slrn7qf3oe.s67.abigail@alexandra.delanet.com>

Peter (pjw7@ukc.ac.uk) wrote on MMCLXIII September MCMXCIII in
<URL:news:37A75A99.5C9C@ukc.ac.uk>:
%% I don't really know that much about unix, but if I download a file of
%% type .tar how do I open/decompress it?


Start with 'man man' and take it from there.


And ask your non-Perl questions elsewhere.



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


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Tue, 03 Aug 1999 21:54:19 -0300
From: Matias Gorfinkiel <henryf@sminter.com.ar>
Subject: using perlcc
Message-Id: <37A78F3A.4CA9758C@sminter.com.ar>

I'm trying to compile a perl script on a Sun with Solaris 2.6 when I run
perlcc xxxx.pl it gives me the following error:

ld: fatal: library -ldb: not found

I try to run the gcc line whitout the -ldb but when I install the binary
in a machine where the perl is not installed it fails to run.
Does any one knows what is that library. I running gcc 2.8.1

Thanks
Sebastian



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

Date: 3 Aug 1999 19:08:53 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why no Perl books at Fry's?
Message-Id: <slrn7qf13h.s67.abigail@alexandra.delanet.com>

Alex Farber (eedalf@eed.ericsson.se) wrote on MMCLXIII September MCMXCIII
in <URL:news:37A6B39C.AFA24EA@eed.ericsson.se>:
@@ Abigail wrote:
@@ > section is usually stuffed with popular and overrated things as HTML,
@@ > O'Reilly's zoo, how to use Netscape, and Windows for dummies. Try to
@@ 
@@ Hey, I like O'Reilly's zoo!

They are overrated.

@@ > find a real important book, like "The Art of Computer Programming" or
@@ > something from the grey wall. Often, they won't even have it. Hyped,
@@ 
@@ What's a grey wall?


Lecture Notes in Computer Science, a high quality Springer-Verlag series.

Yellow walls are rare too.


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())))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 3 Aug 1999 19:12:31 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why no Perl books at Fry's?
Message-Id: <slrn7qf1ab.s67.abigail@alexandra.delanet.com>

Brent A Ellingson (bellings@badlands.NoDak.edu) wrote on MMCLXIII
September MCMXCIII in <URL:news:7o70md$c85$1@news.ndsu.nodak.edu>:
`` Abigail (abigail@delanet.com) wrote:
`` : Try to
`` : find a real important book, like "The Art of Computer Programming" or
`` : something from the grey wall.
`` 
`` This has me curious.  What are you calling "the grey wall?"  In my 
`` mind, "the grey wall" == "VMS manuals," and I have a hard time putting
`` those in the same catagory as Knuth.

Lecture Notes in Computer Science; Springer Verlag. They also have a
yellow wall, for their Math series. Yellow and grey walls are usually
found in academic libraries, although there's at least one book shop in
London (I can't remember the name, but I sure will be able to find it)
that does have a grey wall.



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=>()'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 4 Aug 1999 09:38:03 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Working Telnet Script Needed
Message-Id: <MPG.1212286583817c7e989bd0@news-server>

Chris writes ..
>I spend more time reading your complaints than I do reading questions.
>You presumably spend more time replying than reading them.

nope .. rants are very easy to write .. it's the coding answers that I 
spend a long time on - to make sure they're correct (still I get them 
wrong)

>answer : stop doing it. You're a genius already. Let the others find their
>own way.

it's ironic that you're complaining about a rant that I made to someone 
who was ranting at someone else .. did you actually read the thread ? .. 
I wonder why do I not see a similar post directed to "HC" ?

>Newsgroups were not established especially for you.

really ? .. you're so informative - thank you .. in just over a decade of 
usenet postings I never realised this - but now that you spell it out for 
me it all makes perfect sense .. the whining, the indignation, the 
obstinateness .. it's all coming clear

Chris .. I don't know whether Microsoft even know about killfiles - but 
if you're lucky that newsreader of yours has the ability to add me and my 
address into a killfile which means that you'll never see a post from me 
again .. yesterday I did change my email address for posting - but that 
will not change again for a very long time .. so add me to your killfile 
and forget about me

I assure you .. I'll forget about you in the same way *8^)

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Tue, 03 Aug 1999 21:02:36 -0400
From: HC <carvdawg@patriot.net>
Subject: Re: Working Telnet Script Needed
Message-Id: <37A7912C.8A19245B@patriot.net>

> it's ironic that you're complaining about a rant that I made to someone
> who was ranting at someone else .. did you actually read the thread ? ..
> I wonder why do I not see a similar post directed to "HC" ?

Probably b/c I didn't rant at Chris.  Or b/c I sent the original poster (Scott,

I believe) an actual working piece of code...




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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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 V9 Issue 356
*************************************


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