[15759] in Perl-Users-Digest
Perl-Users Digest, Issue: 3172 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 26 06:07:30 2000
Date: Fri, 26 May 2000 03:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959335512-v9-i3172@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 26 May 2000 Volume: 9 Number: 3172
Today's topics:
Re: "or" vs. "||" - operator precedence question <iltzu@sci.invalid>
Arrays of arrays <jacob@jsanet.dk>
Re: Basic scripting question <nospam@devnull.com>
Re: Basic scripting question <nospam@devnull.com>
Re: can't run the perl CGI script. <justin@lolofie.com>
Re: cgi name-value pairs , special characters <bill.kemp@wire2.com>
Re: DBI:ODBC on windows nt <rhardicr@ford.com>
Re: Does WARN have a reset?? <nospam@devnull.com>
Extract filename from path? <henrik.jonsson@sesig.mail.abb.com>
Re: Extract filename from path? <blah@nospam.com>
Re: Extract filename from path? <billy@arnis-bsl.com>
Re: HELP- Writing to memory IPC?? <billy@arnis-bsl.com>
Help: Undefined Variable, Variable Syntax??? <r27683@email.sps.mot.com>
Re: Help: Undefined Variable, Variable Syntax??? <blah@nospam.com>
Re: Help: Undefined Variable, Variable Syntax??? <andkaha@my-deja.com>
Re: Help: Undefined Variable, Variable Syntax??? <billy@arnis-bsl.com>
Re: Measuring excecution times in milliseconds <nospam@devnull.com>
Re: Mixed results! <nospam@devnull.com>
Re: Newbie: DIV <hove@phys.ntnu.no>
Re: odd behavior printing after randomizing an array fr <rhomberg@ife.ee.ethz.ch>
perl glued with mozilla/xul? <daniel.weberhofer@broadnet.ascom.ch>
Re: randomizing (anagramming words) <kdmiles@lucent.com>
Re: Should be in FAQ: "I can't find Net::SMTP" (Villy Kruse)
system commands (LostSailor)
Re: system commands <blah@nospam.com>
Re: system commands (Neil Kandalgaonkar)
Re: Tanspose rows to columns <nospam@devnull.com>
Re: Tanspose rows to columns <iltzu@sci.invalid>
Re: using param() and CGI.pm to store a persistent valu (Neil Kandalgaonkar)
Re: using param() and CGI.pm to store a persistent valu (Neil Kandalgaonkar)
Re: using param() and CGI.pm to store a persistent valu (Neil Kandalgaonkar)
Re: Visibility of package lexicals in debugger <nospam@devnull.com>
Re: Vs: ? Modules & Version <nospam@devnull.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 May 2000 09:59:21 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: "or" vs. "||" - operator precedence question
Message-Id: <959334792.9746@itz.pp.sci.fi>
In article <8gkg6o$9nc$1@news.panix.com>, Abigail wrote:
>the assignment is in list context. If EXPR1 returns undef, the result
>of ($var) = EXPR1 is (undef), a *LIST* of one element. One would expect
>that such a list in scalar context returns its element, but assignment
>is special. A "list" assignment in scalar context returns the number
>of elements of the list on the right hand side of the assignment.
>(I fail to use why that's useful at the moment.)
It optimizes the common case - in particular it lets me, say, iterate
over a hash with "while (my ($key, $val) = each %hash) {...}" without
having to worry about undefined values and other nuisances.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Fri, 26 May 2000 10:04:51 GMT
From: "Jacob S. Andersen" <jacob@jsanet.dk>
Subject: Arrays of arrays
Message-Id: <7%rX4.1180$Nv3.20021@news000.worldonline.dk>
Hi
Is it possible to have a array of arrays and make a referance to only one
array like this: (it won't work)
@res = somefunc();
@tmp = @res[$i];
print "$tmp[3] $tmp[2]\n";
This one works fine, but it looks more nasty if i using them in 50 different
places and it's probably slower.
@res = somefunc();
print "$tmp[$i][3] $tmp[$i][2]\n";
sub somefunc {
my @result;
.....
foreach $aaa (@bbb) {
......
@result = push [ @ccc ];
}
return @result;
}
Regards,
Jacob
------------------------------
Date: 26 May 2000 08:05:07 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Basic scripting question
Message-Id: <8glb7j$7gn$2@216.155.32.218>
In article <392ABCD8.2FBF0966@stomp.stomp.tokyo>, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
| Chris Allen wrote:
|
| > Anyone smart enough to put a perl script together in the
| > first place would have examined the one-liner posted
| > and agreed it was an elegant solution to the problem.
|
|
| Except for one thing; it doesn't work right.
|
| Godzilla!
not only does it work, but it even works on MY MACINTOSH
which
HAS NO COMMAND LINE
and has to EMULATE one-liners WITH a script.
so much for that argument.
*smiles sweetly.. gradually morphing into a maniacal grin*
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 26 May 2000 08:08:31 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Basic scripting question
Message-Id: <8glbdv$7gn$3@216.155.32.218>
In article <392e1f17.1114428@news.skynet.be>, bart.lateur@skynet.be
(Bart Lateur) wrote:
| Godzilla! wrote:
|
| >Much of
| >our modern code, although efficient and effective,
| >when written, resembles Egyptian hierogyphlics and
| >does not lend well to reading comprehension.
|
| Hieroglyphics were perfectly readable to the Egyptians. Faster even than
| our clumsy English, I would think.
|
| In the same manner, cryptic Perl code is perfectly readable to
| programmers used to the idiom.
|
| I compare it to math notation. You can't do advanced math (efficiently)
| without learning the lingo first.
a very good point and one I'm gonna keep in mind the next time my site
admin wants to hack a piece of text with substr that's more elegantly
handled with a regex, (although sometimes substr is easier, in this case
I refer to, it was not. hee! :)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Fri, 26 May 2000 00:09:24 -0700
From: "Justin" <justin@lolofie.com>
Subject: Re: can't run the perl CGI script.
Message-Id: <sis8mpelo1133@corp.supernews.com>
JL <ltlau@yahoo.com> wrote in message news:392dd9c4@news02.imsbiz.com...
>
> Bart Lateur <bart.lateur@skynet.be> wrote in message
> news:39321c5e.5304711@news.skynet.be...
> > JL wrote:
> >
> > >Can anyone tell me is there anyway that I can run the perl CGI scipt
> which
> > >is saved in ASCII rather than binary? Cuz' if I saved in ASCII, I
can't
> run
> > >the program....but if I change it in binary, then the program run fine.
> > >I dont' understand why???
> >
> > Heh? Are you talking about FTP? Maybe you Perl will choke on
> > inappropriate line endings. But I would expect the reverse.
> >
> > --
> > Bart.
>
> Thanks for your reply.
>
> Actually, I am not talking about FTP. I use Perl Builder in win98 to
write
> the CGI script and save it in my server. But if I want to run the
program,
> I have to use telnet, then use pico to save the file again.
>
Actually, you are talking about FTP. You think Perl Builder is a transfter
protocol? :) It would be called PBTP in that case. As B. L. stated, it is
due to "inappropriate line endings"(that's why you get the weird charcters
in win98 like black blocks instead of new lines). What is wrong with
uploading your files in bin mode?
------------------------------
Date: Fri, 26 May 2000 08:51:52 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: cgi name-value pairs , special characters
Message-Id: <959327605.24795.0.nnrp-10.c3ad6973@news.demon.co.uk>
>programming language forum; I think a certain minimal level of RTFM
>isn't too much to ask, is it?
Trouble is there is also a certain amount of skill in finding the right
manual.
Yours uselessly,
Bill
------------------------------
Date: Fri, 26 May 2000 09:03:00 +0100
From: Richard Hardicre <rhardicr@ford.com>
Subject: Re: DBI:ODBC on windows nt
Message-Id: <392E2FB4.48BB8207@ford.com>
David Krainess wrote:
>
> the code:
>
> ####BEGIN
> #Windows-based Perl/DBI/MS Access example
> use DBI;
>
> #open connection to Access database
> $dbh = DBI->connect('dbi:ODBC:perltest');
>
> #prepare and execute SQL statement
> $sqlstatement="SELECT checknum,vendornum FROM untitled";
> $sth = $dbh->prepare($sqlstatement);
> $sth->execute ||
> die "Could not execute SQL statement ... maybe invalid?";
>
> #output database results
> while (@row=$sth->fetchrow_array)
> { print "@row\n" }
> ####END
>
I can see you're getting errors out, but why not either use some global
error chucking or 'or dies' on your connect/prepare statements?
my $dbh = DBI->connect("DBI:ODBC:database",
undef, undef,
{RaiseError=>1,
PrintError=>0}) or die "Couldn't connect $DBI::errstr";
and experiment with DBI->Trace;
may not solve your problem but may get you closer to it,
as would binning PWS and using Apache,
Richard H
------------------------------
Date: 26 May 2000 09:48:34 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Does WARN have a reset??
Message-Id: <8glh9i$idq$1@216.155.32.231>
In article <MPG.1394578cfa52d77498aaba@nntp.hpl.hp.com>, Larry Rosler
<lr@hpl.hp.com> wrote:
| [Please respond after the material you are responding to, not before.]
|
| In article <392A9962.7C4475A9@ntx.waymark.net> on Tue, 23 May 2000
| 09:44:50 -0500, Tom Turton <tturton@ntx.waymark.net> says...
|
| ...
|
| > Having messed around with PERL for almost 3 years now, and read enough
| > on this newsgroup to NEVER, EVER write a program without 'use
| > diagnostics', I was a bit surprised by this 'feature' of Perl ;-)
|
| Are you misapplying the consensus about 'use strict;' to 'use
| diagnostics'?
|
| The 'diagnostics' pragma is overkill. It is very slow to load, and
| provides no information that cannot be found in perldiag. If your
| programs are warning-free (as they should be), the 'diagnostics' module
| is just baggage at compile time.
I realize myself how much overhead the 'use diagnostics -verbose;' takes
up -- I've tested running scripts with the line and with it commented
out-- the difference is palpably noticible.
HOWEVER, while WRITING a script, it's useful to have it in there.. I
comment it out as soon as I'm done and the script goes into production.
:)
I typically have
#!perl -w
use strict;
use diagnostics -verbose;
and wish MacPerl had a .default.pl that I could get it to open any <N>ew
file with :)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Fri, 26 May 2000 11:11:48 +0200
From: Henrik Jönsson <henrik.jonsson@sesig.mail.abb.com>
Subject: Extract filename from path?
Message-Id: <lT8uOXUq45KHAWaslXWI+yQS6ZEN@4ax.com>
How do I extract a filename from a path?
Both Windows path and Unix paths must be allowed. Something like
basename.
Thanks!
/henrik
------------------------------
Date: Fri, 26 May 2000 11:23:33 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Extract filename from path?
Message-Id: <392E4295.1AFD65FA@nospam.com>
Henrik,
"Henrik J=F6nsson" wrote:
> How do I extract a filename from a path? Both Windows path and =
> Unix paths must be allowed. Something like basename.
Use File::Basename.
Best regards,
Marco
------------------------------
Date: Fri, 26 May 2000 09:37:20 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: Extract filename from path?
Message-Id: <8glgkg$r49$1@nnrp1.deja.com>
In article <lT8uOXUq45KHAWaslXWI+yQS6ZEN@4ax.com>,
henrik.jonsson@sesig.mail.abb.com wrote:
> How do I extract a filename from a path?
>
> Both Windows path and Unix paths must be allowed. Something like
> basename.
>
AFAIK File::Basename module contains fileparse() function, which will IMHO do
the job.
Hope this helps.
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 09:06:28 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: HELP- Writing to memory IPC??
Message-Id: <8gleqe$ptc$1@nnrp1.deja.com>
In article <J6iX4.1627$N4.50100@ozemail.com.au>,
"Ben" <ben.dry@internal.ozemail.com.au> wrote:
> Does anyone know how I can get perl to write a small amount of information
> to memory to be accessed by another script???
>
> For example, a script called send might write a line of text to memory
> initiated by a client, then another client does the same using the same
> script until there are 10 different lines of text in memory. The maximum
> amount of lines that is put into memory is 10, so on the 11th instance the
> oldest line is removed and replaced with the newest one and so on... Another
> script grabs all 10 lines that are current and displays them in a browser...
> I want to do this instead of writing to text files and appending the text
> file because of the amount of people accessing and writing the lines of text
> is quite large and happens quite quickly and I want to avoid them to be
> honest...
>
There are many ways to accomplish your task.
Consult perldoc perlipc (or
http://www.cpan.org/doc/manual/html/pod/perlipc.html).
And also perldoc perlfaq8 (or
http://www.cpan.org/doc/manual/html/pod/perlfaq8.html).
Personally I would use IPC::ShareLite or IPC::Shareable modules from CPAN,
but it's only IMHO.
Hope this helps.
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 16:34:38 +0800
From: Kenneth Lee <r27683@email.sps.mot.com>
Subject: Help: Undefined Variable, Variable Syntax???
Message-Id: <392E371E.71836689@email.sps.mot.com>
--------------33546DA34DEAA4ACC2A3B0A0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I am new to Perl... I have written a simple script (attached below) to
automatically (and remotely) launch Acrobat Reader and set the directory
default to where the document is. Unfortunitely, I encounterred a
problem with the variable definition. The statement 'system' does not
give me the result I intended. Can any one explain the use of scalar
$lhost in this context:
> $command = 'cd /home1/document;' .
> '/opt/Acrobat4/bin/acroread -display $lhost &';
>
If I hard code for -display, the script works okay. With the scalar
$lhost, the error shows up as below:
> 'cd /home1/document;/opt/Acrobat4/bin/acroread -display $lhost &':lhost: Undefined variable
> [1] 6609
>
Rgds, Kenneth
**************************************************************
#!/usr/local/bin/perl
use Telnet ();
$t = new Net::Telnet (Timeout => 10);
$t->errmode('return');
chop ($lhost1 = `/usr/ucb/hostname`);
$lhost = $lhost1 . ':0';
$rhost = 'wwwww.sps.mot.com';
$user = 'xxxxx';
$passwd = 'yyyyy';
system "xhost + $rhost";
$t->open($rhost);
$t->login($user, $passwd);
if ($err = $t->errmsg) {
print "\ncannot connect to $rhost: $err\n";
$t->close;
exit;
}
$command = 'cd /home1/document;' .
'/opt/Acrobat4/bin/acroread -display $lhost &';
@lines = $t->cmd($command);
print qq{'$command':};
print @lines;
$t->close;
sleep 10;
system "xhost - $rhost";
*************************************************************************
--------------33546DA34DEAA4ACC2A3B0A0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I am new to Perl... I have written a simple script (attached below) to
automatically (and remotely) launch Acrobat Reader and set the directory
default to where the document is. Unfortunitely, I encounterred a
problem with the variable definition. The statement 'system' does
not give me the result I intended. Can any one explain the use of scalar
$lhost in this context:
<blockquote TYPE=CITE>
<pre><font color="#3366FF">$command = 'cd /home1/document;' .
'/opt/Acrobat4/bin/acroread -display $lhost &';</font></pre>
</blockquote>
<p><br>If I hard code for -display, the script works okay. With the scalar
$lhost, the error shows up as below:
<blockquote TYPE=CITE>
<pre><font color="#FF6666">'cd /home1/document;/opt/Acrobat4/bin/acroread -display $lhost &':lhost: Undefined variable
[1] 6609</font></pre>
</blockquote>
<p><br>Rgds, Kenneth
<p>**************************************************************
<br>#!/usr/local/bin/perl
<br>use Telnet ();
<p>$t = new Net::Telnet (Timeout => 10);
<br>$t->errmode('return');
<p>chop ($lhost1 = `/usr/ucb/hostname`);
<br>$lhost = $lhost1 . ':0';
<br>$rhost = 'wwwww.sps.mot.com';
<br>$user = 'xxxxx';
<br>$passwd = 'yyyyy';
<p>system "xhost + $rhost";
<p>$t->open($rhost);
<br>$t->login($user, $passwd);
<p>if ($err = $t->errmsg) {
<br> print "\ncannot connect to $rhost: $err\n";
<br> $t->close;
<br> exit;
<br>}
<p>$command = 'cd /home1/document;' .
<br> '/opt/Acrobat4/bin/acroread -display
$lhost &';
<p>@lines = $t->cmd($command);
<br>print qq{'$command':};
<br>print @lines;
<p>$t->close;
<br>sleep 10;
<br>system "xhost - $rhost";
<br>*************************************************************************</html>
--------------33546DA34DEAA4ACC2A3B0A0--
------------------------------
Date: Fri, 26 May 2000 11:27:35 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: Help: Undefined Variable, Variable Syntax???
Message-Id: <392E4387.2B28EEA9@nospam.com>
Kenneth,
Kenneth Lee wrote:
> I am new to Perl... I have written a simple script (attached below)
> to automatically (and remotely) launch Acrobat Reader and set
> the directory default to where the document is. Unfortunitely,
> I encounterred a problem with the variable definition. The
> statement 'system' does not give me the result I intended. Can any
> one explain the use of scalar $lhost in this context:
> $command = 'cd /home1/document;' .
> '/opt/Acrobat4/bin/acroread -display $lhost &';
> If I hard code for -display, the script works okay. With the
> scalar $lhost, the error shows up as below:
> 'cd /home1/document;/opt/Acrobat4/bin/acroread -display
> $lhost &':lhost: Undefined variable [1] 6609
Please, do not post in HTML.
You can not obtain variable interpolations if you surround them in
single quotes. Try with
"/opt/Acrobat4/bin/acroread -display $lhost &";
Best regards,
Marco
------------------------------
Date: Fri, 26 May 2000 09:46:25 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: Help: Undefined Variable, Variable Syntax???
Message-Id: <8glh5e$rg7$1@nnrp1.deja.com>
In article <392E371E.71836689@email.sps.mot.com>,
Kenneth Lee <r27683@email.sps.mot.com> wrote:
>
> --------------33546DA34DEAA4ACC2A3B0A0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> I am new to Perl... I have written a simple script (attached below) to
> automatically (and remotely) launch Acrobat Reader and set the
directory
> default to where the document is. Unfortunitely, I encounterred a
> problem with the variable definition. The statement 'system' does not
> give me the result I intended. Can any one explain the use of scalar
> $lhost in this context:
>
> > $command = 'cd /home1/document;' .
> > '/opt/Acrobat4/bin/acroread -display $lhost &';
> >
>
> If I hard code for -display, the script works okay. With the scalar
> $lhost, the error shows up as below:
>
> > 'cd /home1/document;/opt/Acrobat4/bin/acroread -display $lhost
&':lhost: Undefined variable
> > [1] 6609
> >
>
> Rgds, Kenneth
>
[script and HTML cut]
Replace those single quotes by double quotes to let Perl interpolate
$lhost for you.
/A
--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 09:48:26 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: Help: Undefined Variable, Variable Syntax???
Message-Id: <8glh98$rgp$1@nnrp1.deja.com>
In article <392E371E.71836689@email.sps.mot.com>,
Kenneth Lee <r27683@email.sps.mot.com> wrote:
>
> --------------33546DA34DEAA4ACC2A3B0A0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> I am new to Perl... I have written a simple script (attached below) to
> automatically (and remotely) launch Acrobat Reader and set the directory
> default to where the document is. Unfortunitely, I encounterred a
> problem with the variable definition. The statement 'system' does not
> give me the result I intended. Can any one explain the use of scalar
> $lhost in this context:
>
> > $command = 'cd /home1/document;' .
> > '/opt/Acrobat4/bin/acroread -display $lhost &';
> >
>
> If I hard code for -display, the script works okay. With the scalar
> $lhost, the error shows up as below:
>
Variable interpolation isn't done inside single quotes, use qouble quotes
instead:
$command = "cd /home1/document; /opt/Acrobat4/bin/acroread -display $lhost &";
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 May 2000 09:50:12 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Measuring excecution times in milliseconds
Message-Id: <8glhck$idq$2@216.155.32.231>
In article
<Pine.GSO.4.10.10005231128400.23375-100000@user2.teleport.com>, Tom
Phoenix <rootbeer@redcat.com> wrote:
| > What I would like is a function that simply returns the current system
| > time in milli seconds.
|
| Ah, there's the problem. The FAQ's answer returns time in Milli Vanillis.
| :-)
Someone else screams, "It's not my problem!" ? (:
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 26 May 2000 07:46:33 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Mixed results!
Message-Id: <8gla4p$7gn$0@216.155.32.218>
In article <39298578.4518E2A2@sympatico.ca>, Hassoun
<hassoun@sympatico.ca> wrote:
| i am using MacPerl 5.2.0r4 and CGI.pm v2.45 on a G3. i have installed
| CGI.pm according to the appropriate litterature:
| http://ptf.com/macperl/ptf_book/r/MP/310.Extensibility.html,
Also you will want to *very* tightly scrutinize the webdocs for CGI.pm
as there is a great deal of useful information here.
| but i am still having the same problem. i have built my forms in .html
| files according to HTML 4.0. do i need to rebuild them as cgi scripts?
no, not necessarily.
you can call your CGI scripts VIA a POST or GET form method from the
html form, and pass the results that way.. you don't necessarily HAVE to
rebuild the forms AS CGI scripts (although this is certainly possible).
See http://stein.cshl.org/WWW/software/CGI/ for more info or feel free
to post further questions.
(note spamblocked address also should you choose to e-mail)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 26 May 2000 10:24:25 +0200
From: Joakim Hove <hove@phys.ntnu.no>
Subject: Re: Newbie: DIV
Message-Id: <k0nn1ldpvly.fsf@dhcp-49138.phys.ntnu.no>
Stephan Canisius <SCanisius@dusnet.de> writes:
> 10/3 is 3.333333333 and I only want the 3 given to me.
Well, i guess int () should help you with this. However you should be
aware that int truncates decimals, and does not do mathematically
proper rounding:
#!/usr/bin/perl -w
$three = int 10/3;
$four = int 19/4;
Joakim
--
=== Joakim Hove www.phys.ntnu.no/~hove/ ======================
# Institutt for fysikk (735) 93637 / E3-166 | Skøyensgate 10D #
# N - 7491 Trondheim hove@phys.ntnu.no | N - 7030 Trondheim #
================================================ 73 93 31 68 ========
------------------------------
Date: Fri, 26 May 2000 11:03:21 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: odd behavior printing after randomizing an array from STDIN
Message-Id: <392E3DD9.DBDDEF82@ife.ee.ethz.ch>
Decklin Foster wrote:
>
> Kiera <kiera@nnickee.com> writes:
>
> > while(<>) {@b = <>}
>
> i'm pretty sure you mean
>
> while(<>) { push @b, $_; }
Or rather
@b = <>;
- Alex
------------------------------
Date: Fri, 26 May 2000 10:33:41 +0200
From: "daniel weberhofer" <daniel.weberhofer@broadnet.ascom.ch>
Subject: perl glued with mozilla/xul?
Message-Id: <8glct7$doj$1@ascomax.hasler.ascom.ch>
Hi there,
Mozillas xul (xml based user interface langue) looks much
simpler than perl/Tk or Win32:GUI. Is there anybody who
has glued perl and Mozilla together?
Thanks,
Daniel
------------------------------
Date: Fri, 26 May 2000 08:46:28 +0100
From: Kevin Miles <kdmiles@lucent.com>
To: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: randomizing (anagramming words)
Message-Id: <392E2BD4.E7EAF465@lucent.com>
Ala,
now that worked - thanks very much!!
Kev
Ala Qumsieh wrote:
>
> Did you try it? What did it give you?
>
> % perl -Mstrict -wl
> my $string = 'England';
> my $new;
> $new .= $_ while $_ = substr $string =>
> rand length $string, 1, '';
> print $new;
> __END__
> gadEnln
>
> > It would be much more useful if you posted more detail than "doesn't
> > seem to work", but the problem is most likely your Perl version. Ala's
> > solution requires >= 5.005.
>
> I don't think so. 'EXPR while EXPR' has been supported for a while
> (don't know when it was first introduced, but definitely before
> 5.005). I guess you might have confused this with 'EXPR for EXPR' which
> was introduced in 5.005.
>
> --Ala
--
Kevin Miles
------------------------------
Date: 26 May 2000 07:14:49 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Should be in FAQ: "I can't find Net::SMTP"
Message-Id: <slrn8is926.up6.vek@pharmnl.ohout.pharmapartners.nl>
On Fri, 26 May 2000 11:56:38 +0800, John Lin <johnlin@chttl.com.tw> wrote:
>Dear all,
>
>I have been asked this question for many times.
>
>"I can't find Net::SMTP module in CPAN."
>
>Actually, we should redirect them to look for "libnet" instead, right?
>Can we put this answer in the FAQ?
>
If you run the cpan utility (perldoc CPAN will tell you how to)
and then issue the command
i /Net::SMRP/
it will refer you to G/GB/GBARR/libnet-1.0703.tar.gz
Villy
------------------------------
Date: Fri, 26 May 2000 07:23:14 GMT
From: pharrer@idmail.com (LostSailor)
Subject: system commands
Message-Id: <392e25fd.421274@news.direct.ca>
Hello. I'm trying to run an AWK program on a windowsNT iis server. The
perl script successfully returns back an html page but won't execute
the AWK program. Any idea what I'm doing wrong?
Please email me personally.
-Pete
------------------------------
Date: Fri, 26 May 2000 11:11:09 +0200
From: Marco Natoni <blah@nospam.com>
Subject: Re: system commands
Message-Id: <392E3FAD.A463CC1A@nospam.com>
Pete,
LostSailor wrote:
> I'm trying to run an AWK program on a windowsNT iis server. The
> perl script successfully returns back an html page but won't
> execute the AWK program. Any idea what I'm doing wrong?
Have you considered the hypothesis to translate the AWK script in
PERL? I think that it should be easy, since AWK features are fully
covered in PERL.
Best regards,
Marco
------------------------------
Date: 26 May 2000 09:43:55 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: system commands
Message-Id: <8glh0r$46v$1@newsflash.concordia.ca>
In article <392E3FAD.A463CC1A@nospam.com>,
Marco Natoni <mnatoni@rumbanet.it> wrote:
>LostSailor wrote:
>> I'm trying to run an AWK program on a windowsNT iis server. The
>> perl script successfully returns back an html page but won't
>> execute the AWK program. Any idea what I'm doing wrong?
I think we need more detail as to what you're doing, what you expected,
and what you got.
> Have you considered the hypothesis to translate the AWK script in
>PERL? I think that it should be easy, since AWK features are fully
>covered in PERL.
perl is bundled with a2p, the awk-to-perl translator.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: 26 May 2000 08:25:37 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Tanspose rows to columns
Message-Id: <8glce1$7gn$4@216.155.32.218>
In article <959080427.17650@itz.pp.sci.fi>, Ilmari Karonen
<usenet11100@itz.pp.sci.fi> wrote:
| Hmmph - it appears the target has moved. Normally I wouldn't have
| bothered, but I'd already done what you're now asking for right after
| posting my previous suggestion.
|
| This is tested code, and you can test it yourself by pasting it into a
^^^^^^^^^^^^^^^^^^^
*cough* see below
| file and running it. Don't include my signature unless you wish to
| transpose it too..
|
|
| #!/usr/bin/perl -w
| use strict;
|
| sub _transpose {
| my ($tree, $perm, $new, @pos) = @_;
| if (@pos < @$perm) {
| my $i = 0;
| _transpose($_, $perm, $new, @pos, $i++) for @$tree;
| } else {
| $new = \$$new->[$_] for map $pos[$_ - 1] => @$perm;
| $$new = $tree;
| }
| }
|
| sub Transpose {
| my ($tree, $perm) = @_;
| $perm ||= [2,1];
| _transpose($tree, $perm, \my $new);
| return $new;
| }
|
| # test 3-level transpose:
| my @matrix = map [map [split//] => split] => <DATA>;
| print join(" " => map join("" => @$_) => @$_), "\n" for @matrix;
| print "--\n";
| print join(" " => map join("" => @$_) => @$_), "\n" for
| @{Transpose(\@matrix, [3,1,2])};
|
| __DATA__
| abc def ghi
| jkl mno pqr
| stu vwx yz.
# syntax error, near ") for "
File 'Untitled'; Line 8
# Missing $ on loop variable.
File 'Untitled'; Line 10
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 26 May 2000 09:42:26 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Tanspose rows to columns
Message-Id: <959333743.7487@itz.pp.sci.fi>
In article <8glce1$7gn$4@216.155.32.218>, The WebDragon wrote:
># syntax error, near ") for "
>File 'Untitled'; Line 8
># Missing $ on loop variable.
>File 'Untitled'; Line 10
Upgrade your perl. It works on 5.005 just fine. Or just feed the
script through this one-liner:
perl -pi -e 's/(\S.*) for (.*);/for ($2) {$1}/'
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: 26 May 2000 08:39:22 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <8gld7q$fdr$1@newsflash.concordia.ca>
In article <392DCF55.F6BBA3E7@uptimeresources.net>,
Chris <csorensen@uptimeresources.net> wrote:
>I'm really struggling with this one. I need to store a value that is
>passed in the url from a referring site. I grabbed a copy of Lincoln's
>book and put the following together. Unfortuantely it's not working and
>I can't find my error. the shebang is correct, I think the cookie()
>syntax is correct (I copied it from the book) .. any ideas .. anyone ??
>
>I'm hoping that this is an error in my perl code and that someone here
>will point it out to me ..
I'm confused. If you need to retrieve a standard CGI parameter, cookies
seem irrelevant. And if you wanted to tag the remote browser with a
cookie, I'm not sure why you are storing the referring siteID of all things.
Is it that you want to permanently record where a particular user came
from on the very first visit? If so you should test if the cookie is
set already.
Anyway, even though I think this code is barking up the wrong tree,
some mistakes:
>#!/usr/bin/perl
#!/usr/bin/perl -w
use strict; # trust me on this, you really want -w and strict,
# especially if you are a beginner.
>use CGI qw(:standard);
>
>#set cookie to capture siteID variable passed in URL from referring site
>
>cookie ( -name=>'siteID',
> -value=>'param(siteID)');
You can't set a cookie like this as far as I know, you need to include it
in the header manually.
If you quote the 'param', perl doesn't know that from any other string.
>@cookie_value = cookie(-name=>'siteID');
You can't retrieve the cookie until the next request. Unless you are
retrieving old values and setting new values in which case my brain
hurts, and we should use the object syntax to avoid confusion.
># jump to correct starting page
>
>start_html('refresher'),
>
><meta http-equiv="refresh" content="1;URL=http://insuremybiz.com">,
Refresh pages are lame. They make it impossible to go back a step.
Consider using a redirect instead. See the CGI book or the CGI docs.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: 26 May 2000 09:18:29 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <8glfh5$u3d$1@newsflash.concordia.ca>
In article <392E098E.63E40BE3@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>It is
>in dealing with modules you are having basic
>problems; get rid of them.
>
>KISS: Keep It Simple Silly.
Most people find using modules reduces the complexity of the
code they have to write. Sometimes at the cost of execution speed.
Honestly, Kira, if you would take a little time to learn them,
I think you'd grow to like them. Perhaps you had bad experiences
the few times you tried it and went back to perl4, which is
your right.
>First though, on cgi-wrap, after years of
There is no reference to cgiwrap in the OP's question.
>Watch out for cgi-wrap confusing a numerical
>value of 0 (zero) for undefined and, never
You have made similar (disproven) claims about the CGI.pm module.
Are you confusing CGI.pm and cgiwrap?
I don't use cgiwrap on a regular basis but I've never noticed this
behavior.
>TEST SCRIPT
>___________
This test script is not only replete with inefficiencies, as far as
I can tell it does not actually set a cookie.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: 26 May 2000 09:28:56 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <8glg4o$p18$1@newsflash.concordia.ca>
In article <8glfh5$u3d$1@newsflash.concordia.ca>,
Neil Kandalgaonkar <nj_kanda@alcor.concordia.ca> wrote:
>There is no reference to cgiwrap in the OP's question.
Ah, I was wrong, the news articles came in out of order for me.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: 26 May 2000 07:55:00 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Visibility of package lexicals in debugger
Message-Id: <8glakk$7gn$1@216.155.32.218>
In article <m1r9att51s.fsf@halfdome.holdit.com>, merlyn@stonehenge.com
(Randal L. Schwartz) wrote:
| >> Paging Tom Pheonix...
|
| Bart> That won't work.
|
| Bart> Paging Tom Phoenix...
|
| Bart> Now you have a chance.
|
| Perhaps he was looking for the author of:
|
| "hooked on Pheonix"
|
| (ducking rapidly... :)
*OOFs* rather audibly and is thankful that he wasn't sipping coffee at
the moment.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 26 May 2000 09:23:20 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Vs: ? Modules & Version
Message-Id: <8glfq8$idq$0@216.155.32.231>
In article <jLuW4.211$Zc6.6996@read2.inet.fi>, "Marko Nikulainen"
<marko.nikulainen@etela-savo.com> wrote:
| > I only have ftp access to my host.
| > Often a script which runs fine on my Linux box fails on the host.
| > Usually it is a local config prob but sometimes it's module related.
| > I would like to know if there is a simple command/way of listing all
| > the
| > modules/versions on the host.
| >
| > Much obliged, JohnShep.
| >
| >
| http://www.scriptsolutions.com/programs/free/perldiver/index.html
| Here you can find a free script that prints enviroment variables,
| installed
| modules and server program paths.
Interestingly enough, this script, (once I scanned through it, and
re-organized all the stuff they did internally to it to make it all one
single line of text, and checked it over for funky things) when tested
on my Macintosh using the WebSharing controls .. barely reported half of
the installed Modules.
Anyone have any clues why?
the relevant portion of the script is this:
find(\&wanted,@INC);
sub wanted {
$count = 0;
if ($File::Find::name =~ /\.pm$/) {
open(MODFILE,$File::Find::name) || return;
while(<MODFILE>) {
if (/^ *package +(\S+);/) {
push (@foundmods, $1);
last;
}
}
}
}
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 3172
**************************************