[19505] in Perl-Users-Digest
Perl-Users Digest, Issue: 1700 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 5 18:05:26 2001
Date: Wed, 5 Sep 2001 15:05:07 -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: <999727507-v10-i1700@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 5 Sep 2001 Volume: 10 Number: 1700
Today's topics:
bad header <mattc@country-life.com>
Re: Difference between .pl, .cgi, and .pm File Extensio (Michael Houghton)
Re: DumbQuestion::CGI_parser <bart.lateur@skynet.be>
Re: fore! (Steven M. O'Neill)
gcc for perl source distribution <Willi.Rattei@dlr.de>
Re: Getting response from KEA \ Reflection (Brian Duffy)
Help please! What's the download progress box called. <tailorontap@pantsbtinternet.com>
Re: Help please! What's the download progress box calle <tony_curtis32@yahoo.com>
How to Benchmark CGI Performance ? <tag@gmx.de>
Re: How to Benchmark CGI Performance ? <Crazydj@web.de>
Re: How to Benchmark CGI Performance ? <tag@gmx.de>
Re: How to Benchmark CGI Performance ? <comdog@panix.com>
Perl 5.005_03 under Solaris 2.7 <showie@uoguelph.ca>
Perl idiot needs help with simple script (Rich Daley)
Re: Perl idiot needs help with simple script (Andreas Schmitz)
Re: pl or not pl, that is the question (Abigail)
Programming with pipes and fork <Crazydj@web.de>
Re: references, slices, voodoo (Abigail)
Re: Undef'ing multiple variables (Damian Conway)
Re: Undef'ing multiple variables <uri@sysarch.com>
unique perl R&D opportunity in Houston (Scott Mears)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 05 Sep 2001 17:35:10 -0400
From: Matt Carey <mattc@country-life.com>
Subject: bad header
Message-Id: <3B969A8E.3FD15620@country-life.com>
I have a perl program which accepts input from an html form where a user
can enter comments in a text area.(using Apache,Linux)
When the form is submitted, the perl program stores the user input in a
variable($parameter) and then executes a shell command passing the
variable to a perl program on another machine(HP-UNIX) where the data
gets written out to a file.
$runcommand = "rsh machine /usr/bin/nsperl
/u/data/CONSAC/SRC.PERL/runuvprog.pl $parameter";
system ($runcommand);
When the shell command returns the perl program reads in an html
page(stating that the form has been received) from a file and prints it
out to the browser.
sub print_page{
print "Content-type: text/html\n\n";
open(INFILE, "<$infile");
while(<INFILE>){
print;
}
close(INFILE);
}
This works fine when only one line of text has been input in the text
area. When I submit the form after having entered more than one line of
comments in the text area(and the text has wrapped) then I get an error
message:
The server encountered an internal error or misconfiguration and was
unable to complete your request.
The server error log says:
[Wed Sep 5 09:27:10 2001] [error] [client 131.2.4.203] malformed header
from script. Bad header=Attempted READ of record ID la:
/home/httpd/cgi-bin/peer.pl
Although I get an error message, the data($parameter) always gets passed
via the rsh command and written out to file correctly.
I'm trying to find out how the wrapping of the text in the text area
would cause the perl program to generate the error message. I've tried
stripping out carraige returns and line feeds which didn't seem to help
any.
Thanks for any suggestions.
------------------------------
Date: 5 Sep 2001 14:55:35 -0400
From: herveus@Radix.Net (Michael Houghton)
Subject: Re: Difference between .pl, .cgi, and .pm File Extensions.
Message-Id: <9n5sf7$3ho$1@saltmine.radix.net>
Howdy!
In article <Pine.LNX.4.30.0108292250500.7319-100000@lxplus023.cern.ch>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
>On Aug 29, brian d foy inscribed on the eternal scroll:
>
>(re. use of .pl as a filename 'extension'):
>
>> perl *library*. some people frown on using this (or any)
>> extension for scripts. sometimes you'll see .plx (perl
>> executable) since some operating systems jsut can't do
>> without.
>
>Well, since the canonical building procedure starts with
>
> perl Makefile.PL
>
>it would seem that someone "in authority" thinks that Perl scripts
>have a filename extension of .PL (upper case).
>
Among the things one can discover by reading the docs for
ExtUtils::MakeMaker is the fact that the Makefile that comes out of
'perl Makefile.PL' by default will execute every other .PL file
as the last step of "make". Each such script is expected to produce
the corresponding perl script, eg Foo.PL writes Foo.
yours,
Michael
--
Michael and MJ Houghton | Herveus d'Ormonde and Megan O'Donnelly
herveus@radix.net | White Wolf and the Phoenix
Bowie, MD, USA | Tablet and Inkle bands, and other stuff
| http://www.radix.net/~herveus/
------------------------------
Date: Wed, 05 Sep 2001 18:10:03 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: DumbQuestion::CGI_parser
Message-Id: <cfqcpt4edpfnlmm69kumdffvmd3ro56auu@4ax.com>
Martin Mielke wrote:
>The script used alone works pretty fine but problems arise when I use it as
>CGI...
>
>What obvious part am I overseeing?
Probably this...
perldoc -q CGI
Found in D:\programs\indigoperl\lib\pod\perlfaq9.pod
My CGI script runs from the command line but not the browser. (500
Server Error)
--
Bart.
------------------------------
Date: 5 Sep 2001 18:45:40 GMT
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: fore!
Message-Id: <9n5rsk$od3$1@news.panix.com>
Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>perl -lne \
> 'END{$,=" ";print keys%x}$f++if eof;$f?delete$x{$_}:++$x{substr$_,3}' \
> dis /usr/share/dict/words
Okay, maybe "fore!" was the wrong subject. I do see some useful
things to pay attention to, notably the -n part, but what I'd really
like is a less obfuscated way to do it. Solving the particular
program isn't as important to me as learning how to think in
one-liners.
--
Steven O'Neill steveo@panix.com
www.cars-suck.org
------------------------------
Date: 05 Sep 2001 19:51:09 +0200
From: Super-User <Willi.Rattei@dlr.de>
Subject: gcc for perl source distribution
Message-Id: <u1yhil0x.fsf@dlr.de>
Hello,
could somebody tell me about prerequisites needed to compile
perl-5.6.1 on Solaris 8 successfully?
I got gcc-3.0.1.pkg and installed it.
After gunzip of the perl distribution, I read carefully the INSTALL,
and README files and did the Configure.
But finally, the make broke at the very beginning with following basic
messages:
hera2{root}446: make
make: Warning: Both `makefile' and `Makefile' exist
`sh cflags libperl.a miniperlmain.o` miniperlmain.c
CCCMD = gcc -B/usr/ccs/bin/ -DPERL_CORE -c -D_REENTRANT -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O
`sh cflags libperl.a perl.o` perl.c
CCCMD = gcc -B/usr/ccs/bin/ -DPERL_CORE -c -D_REENTRANT -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O
/usr/ccs/bin/as: "/var/tmp/ccPyF1Dd.s", line 2209: error: unknown opcode ".subsection"
/usr/ccs/bin/as: "/var/tmp/ccPyF1Dd.s", line 2209: error: statement syntax
/usr/ccs/bin/as: "/var/tmp/ccPyF1Dd.s", line 2333: error: unknown opcode ".previous"
/usr/ccs/bin/as: "/var/tmp/ccPyF1Dd.s", line 2333: error: statement syntax
/usr/ccs/bin/as: "/var/tmp/ccPyF1Dd.s", line 4994: error: unknown opcode ".subsection"
/usr/ccs/bin/as: "/var/tmp/ccPyF1Dd.s", line 4994: error: statement syntax
/usr/ccs/bin/as: "/var/tmp/ccPyF1Dd.s", line 5117: error: unknown opcode ".previous"
/usr/ccs/bin/as: "/var/tmp/ccPyF1Dd.s", line 5117: error: statement syntax
*** Error code 1
make: Fatal error: Command failed for target `perl.o'
The only idea I have is, that gcc may need the binutils package
instead of /usr/ccs/bin/as?
Particular hints for PATH or LD_LIBRARY_PATH?
I'd appreciate any hints resolving that installation problem.
Thank you very much in advance
Willi
------------------------------
Date: 5 Sep 2001 12:20:26 -0700
From: bduffy@nycap.rr.com (Brian Duffy)
Subject: Re: Getting response from KEA \ Reflection
Message-Id: <8382da14.0109051120.1da7adeb@posting.google.com>
Paul,
I noticed that the strings that you are sending out on the TTY contain
special characters.
You might want to try prepending the ';' and '.' characters with a
backslash '\'. Perl tries to interpet anything within double-quotes
and the backslash will prevent that.
Hope it helps!
bduffy@nycap.rr.com
"Paul Keirnan" <paul.keirnan@det.nsw.edu.au> wrote in message news:<3b9431ed$1@isuwb1.itbcorpweb.det.nsw.edu.au>...
> Greetings,
>
> I am new to both Perl (which I like) and also to Unix, although
> I have 25yrs experience in other languages and OSes.
>
> I am currently converting some DCL scripts from VMS to
> run on TRU64 Unix (on Alphas).
>
> My Perl version is perl, v5.6.1 built for alpha-dec osf-ld.
>
> The script I am having trouble with takes a filestring as a parameter,
> and
> transfers that file from the host to the users PC. It needs to do this
> unattended (I.e. no interaction from the user).
>
> This means that it must first determine what Terminal Emulation software
> the user is running (in our case, either Reflection or KEA).
>
> For KEA, a control sequence of '<ESC>[ 5;1.z' solicits a response
> of '<DCS>5.yKEAterm<ST>'.
> And for Reflection, '<ESC>[0;1234c' gives a response of
> 'W02-700L456789'.
>
> The problems are:
>
> 1. The responses are not terminated by CR or CRLF, so I need a timeout.
>
> 2. I am totally unable to get the responses into a variable so that I
> may
> test them. If I have 'echo' turned on for the terminal, then the
> responses
> are visible, but I can't capture them into the script.
>
> [Note: On VMS the response was captured using a Basic program. I don't
> wish to
> use Basic on Unix].
>
> I have tried several things, among them being:
>
> Perl:
> use Term::ReadKey;
> open(TTY, "</dev/tty");
> print "\e[5;1.z";
> # `sleep 1`;
> ReadMode "raw";
> do {
> $key = ReadKey -1, *TTY;
> if ($key) {$string .= $key;}
> } until (!$key);
> ReadMode "normal";
> print "\nResponse was |$string|\n";
> exit;
> KSH:
> echo "Trying KEA..."
> stty -echo
> echo "\033[5;1.z"
> ## sleep 1
> ## echo "\n"
> ##read hoststseq
> if read | grep -q 'KEA'
> then
> stty echo
> echo "Found KEA"
> exit 3
> else
> stty echo
> echo "Rats"
> exit 4
> fi
> exit
> Would anyone be able to point me in the right direction?
>
> Thank you,
> Paul
> Sydney, Australia
>
> --
------------------------------
Date: Wed, 5 Sep 2001 22:42:18 +0100
From: "Tony" <tailorontap@pantsbtinternet.com>
Subject: Help please! What's the download progress box called.
Message-Id: <9n660m$472$1@plutonium.btinternet.com>
More important - if you would guide the uninformed. What is the function or
object called which on password validation shows download progress kb sec,
remaining time etc when a file is dowloaded - by FTP I think . I suppose.
Thanks.
--
The New JetTec inkjet cartridges for Epson and chips
680/790/1270/2000P with the new ILRS ink level computer
http://www.inkylink.co.uk
remove pants to reply personally
------------------------------
Date: Wed, 05 Sep 2001 16:45:26 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Help please! What's the download progress box called.
Message-Id: <87n149l3bd.fsf@limey.hpcc.uh.edu>
>> On Wed, 5 Sep 2001 22:42:18 +0100,
>> "Tony" <tailorontap@pantsbtinternet.com> said:
> More important - if you would guide the uninformed. What
> is the function or object called which on password
> validation shows download progress kb sec, remaining
> time etc when a file is dowloaded - by FTP I think . I
> suppose.
Perl is a programming language. It does not have
"password validation" or "download progress". One can
implement these for various circumstances, but you supply
no context.
What is it you actually want to do? Do you want to write
a WWW browser in perl?
hth
t
--
Yes way! Mmmmkay?
------------------------------
Date: Wed, 05 Sep 2001 22:39:32 +0200
From: Toni Duago <tag@gmx.de>
Subject: How to Benchmark CGI Performance ?
Message-Id: <3B968D84.2A43B856@gmx.de>
Hy everybody,
I'd like to know how I could possibly run a reliable Benchmarking
test on a Server that has different perl CGIs on it. I think it is not
sufficient to just send requests to the server and watch the CPU usage
grow. I would like to have results like "20 requests/second processed".
Maybe this is a little off-topic, but does anybody know if there are
tools that can do these Benchmarks ? Or does anybody know how I could
write a script that can do exactly this thing ?
Thanks in advance.
Y.T.,
Toni
F'up de.comp.lang.perl.cgi
------------------------------
Date: Wed, 05 Sep 2001 22:50:29 +0200
From: Crazydj <Crazydj@web.de>
Subject: Re: How to Benchmark CGI Performance ?
Message-Id: <3B969014.240F1E9A@web.de>
Have you tried the Benchmark Perl module??
For a description see perldoc Benchmark.
The module can tell you the time a specific code or just your hole script
took...
Greetz
Bastian Ballmann
Toni Duago schrieb:
> Hy everybody,
> I'd like to know how I could possibly run a reliable Benchmarking
> test on a Server that has different perl CGIs on it. I think it is not
> sufficient to just send requests to the server and watch the CPU usage
> grow. I would like to have results like "20 requests/second processed".
>
> Maybe this is a little off-topic, but does anybody know if there are
> tools that can do these Benchmarks ? Or does anybody know how I could
> write a script that can do exactly this thing ?
> Thanks in advance.
>
> Y.T.,
> Toni
>
> F'up de.comp.lang.perl.cgi
--
Djz rule the world! ...and some other staff ;-p Find out at http://www.crazydj.de
------------------------------
Date: Wed, 05 Sep 2001 23:06:31 +0200
From: Toni Duago <tag@gmx.de>
Subject: Re: How to Benchmark CGI Performance ?
Message-Id: <3B9693D7.E8568DA7@gmx.de>
> Have you tried the Benchmark Perl module??
> For a description see perldoc Benchmark.
> The module can tell you the time a specific code or just your hole script
> took...
> Greetz
Yes, i know the Benchmark Module, but that's not exactly what I need.
It is irrelvant to me how long each individual script took to process,
but I need to know how many connections my server can handle
Y.T.,
Toni
------------------------------
Date: Wed, 05 Sep 2001 17:18:49 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: How to Benchmark CGI Performance ?
Message-Id: <comdog-64F857.17184905092001@news.panix.com>
In article <3B968D84.2A43B856@gmx.de>, Toni Duago <tag@gmx.de> wrote:
> Hy everybody,
> I'd like to know how I could possibly run a reliable Benchmarking
> test on a Server that has different perl CGIs on it. I think it is not
> sufficient to just send requests to the server and watch the CPU usage
> grow. I would like to have results like "20 requests/second processed".
Lincoln Stein has a torture.pl script he wrote for some magazine.
http://stein.cshl.org/~lstein/torture/
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: 5 Sep 2001 19:52:45 GMT
From: Steve Howie <showie@uoguelph.ca>
Subject: Perl 5.005_03 under Solaris 2.7
Message-Id: <9n5vqd$gm0$1@testinfo.cs.uoguelph.ca>
Hi,
Having problems reading and writing to files >2Gb. in size on a Solaris 2.7
filesystem using Perl 5.005_03. I understand it's something to do with
the Perl malloc() routines barf'ing. Is there a quick fix/recommended
workaround, or should I upgrade to a newer version of Perl?
The stat() Perl system call also returns totally messed-up results.
Yes, I do have largefile support turned on for the file system in question.
Many thanks,
Scotty
--
Steve Howie root@127.0.0.1
Netnews and Listserv Admin 519 824-4120 x2556
University of Guelph
"If it's not Scottish it's CRRRRAAAAAAAPPPPPP!"
------------------------------
Date: 5 Sep 2001 14:03:36 -0700
From: owl@theowls.co.uk (Rich Daley)
Subject: Perl idiot needs help with simple script
Message-Id: <e875ad8e.0109051303.12a5e9df@posting.google.com>
OK I've written a CGI script to almost the textbook standard. The
script asks a user to fill in a form, and then emails the results to
owl@theowls.co.uk.
Straightforward, I thought, but when I run it, it gives no error
messages, but no email is sent to that address.
I am a complete newbie when it comes to programmming in Perl and I
need all the help I can get. Any suggestions will be _gladly_
accepted.
My script appears, in full, below.
Thanks in advance,
Rich
PS the site is hosted on f2s.com, which doesn't allow for shell
logins.
---------------------
#!/usr/bin/perl
use CGI;
$query = new CGI;
#setup variables
$sendmail = "/usr/sbin/sendmail -n -t -oi";
$to = "owl\@theowls.co.uk";
if (!$query->param()) {
&print_page_start;
&print_form;
&print_page_end;
}
else {
&set_form_vars;
if (&valid_form eq 'yes') {
&send_email;
&print_page_start;
&print_success;
&print_page_end;
}
else {
&print_page_start;
&print_error_message;
&print_form;
&print_page_end;
}
}
sub print_page_start {
print $query->header;
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>ndlearning - contact form</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<font face=\"Verdana, Arial, Helvetica, sans-serif\" ";
print "color=\"#000000\" size=2>\n";
print "<table border=\"0\" width=\"100%\"
bgcolor=\"#9900CC\">\n";
print "<tr><td>\n";
print "<b><font face=\"Verdana, Arial, Helvetica, sans-serif\"
color=\"#ffffff\" size=5>\n";
print "Contact Form\n";
print "</font></b>\n";
print "</td></tr>\n";
print "</table>\n";
print "<p><font face=\"Verdana, Arial, Helvetica, sans-serif\"
color=\"#9900CC\" size=2>\n";
print "<b>Note: The fields marked with asterisks (*) must be
completed</b></font></p>\n";
}
sub print_page_end {
print "</BODY>\n";
print "</HTML>\n";
}
sub set_form_vars {
$name = $query->param('name');
$email = $query->param('email');
$company = $query->param('company');
$address1 = $query->param('address1');
$address2 = $query->param('address2');
$town = $query->param('town');
$county = $query->param('county');
$postcode = $query->param('postcode');
$country = $query->param('country');
$phone = $query->param('phone');
$fax = $query->param('fax');
$comments = $query->param('comments');
$contact = $query->param('contact');
$how = $query->param('how');
}
sub print_form {
print "<FORM METHOD=\"post\">\n";
print "<table border=\"0\">\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nName*:</td>\n";
print "<td><input type=\"text\" name=\"name\"
value=\"$name\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nEmail address*:</td>\n";
print "<td><input type=\"text\" name=\"email\"
value=\"$email\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nCompany:</td>\n";
print "<td><input type=\"text\" name=\"company\"
value=\"$company\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nAddress (line 1):</td>\n";
print "<td><input type=\"text\" name=\"address1\"
value=\"$address1\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nAddress (line 2):</td>\n";
print "<td><input type=\"text\" name=\"address2\"
value=\"$address2\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nTown/City:</td>\n";
print "<td><input type=\"text\" name=\"town\"
value=\"$town\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nCounty:</td>\n";
print "<td><input type=\"text\" name=\"county\"
value=\"$county\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nPost Code:</td>\n";
print "<td><input type=\"text\" name=\"postcode\"
value=\"$postcode\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nCountry (if not
UK):</td>\n";
print "<td><input type=\"text\" name=\"country\"
value=\"$country\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nDaytime telephone
number:</td>\n";
print "<td><input type=\"text\" name=\"phone\"
value=\"$phone\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nFax number:</td>\n";
print "<td><input type=\"text\" name=\"fax\"
value=\"$fax\">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nAdditional
Comments:</td>\n";
print "<td><textarea name=\"comments\" wrap=\"physical\"
rows=5 cols=40>";
print $comments;
print "</textarea></td></tr>\n";
print "<tr><td colspan=\"2\"><font face=\"Verdana, Arial,
Helvetica, sans-serif\" ";
print "color=\"#000000\" size=2>\nTick if you would like me to
contact you: \n";
print "<input type=\"checkbox\" name=\"contact\"
value=\"yes\"";
if ((!$query->param()) || ($contact eq 'yes')) {
print " CHECKED ";
}
print ">\n";
print "</td></tr>\n";
print "<tr><td><font face=\"Verdana, Arial, Helvetica,
sans-serif\" ";
print "color=\"#000000\" size=2>\nIf "yes",
how?</td>\n";
print "<td><select name=\"how\">\n";
print "<option value=\"email\">Email\n";
print "<option value=\"post\" ";
if ($how eq 'post') {
print "SELECTED";
}
print ">Post\n";
print "<option value=\"phone\" ";
if ($how eq 'phone') {
print "SELECTED";
}
print ">Telephone\n";
print "<option value=\"fax\" ";
if ($how eq 'fax') {
print "SELECTED";
}
print ">Fax\n";
print "<option value=\"visit\" ";
if ($how eq 'visit') {
print "SELECTED";
}
print ">Personal Visit\n";
print "</select></td>\n";
print "<tr><td height=\"15\"></td></tr>\n";
print "<tr><td><input type=\"submit\" value=\"Send\">\n";
print "</td></tr></table>\n";
print "</form>\n";
}
sub valid_form {
$success = "yes";
if (!$name) {
$name_error = "<p><font color=\"#ff0000\"><b>";
$name_error .= "ERROR: You must specify your
name.</b></font></p>\n";
$success = "no";
}
if ($email !~ /^[\w.-]+\@[\w.-]+$/) {
$email_error = "<p><font color=\"#ff0000\"><b>";
$email_error .= "ERROR: You must enter a VALID email
address.</b></font></p>\n";
$success = "no";
}
if (!$email) {
$email_error = "<p><font color=\"#ff0000\"><b>";
$email_error .= "ERROR: You must enter your email
address.</b></font></p>\n";
$success = "no";
}
return $success;
}
sub print_error_message {
if ($name_error) {
print $name_error, "\n";
}
if ($email_error) {
print $email_error, "\n";
}
}
sub print_success {
print "<p>Thankyou, $name. Nicola has been emailed with ";
print "those details.</p>\n";
print "<p>Please close this window to continue</p>\n";
}
sub send_email {
open(MAIL, "| $sendmail") or
die "Couldn't open sendmail: ";
print MAIL <<EOF;
From: $email
To: $to
Subject: Email Contact Form Response
Form filled in by: $name ( $email )
Company: $company
Address:
$address1
$address2
$town
$county
$postcode
$country
Phone: $phone Fax: $fax
Their comments:
$comments
Should you contact them back: $contact
How: by $how
EOF
close MAIL;
//}
------------------------------
Date: Wed, 05 Sep 2001 21:58:14 GMT
From: technik@medialsoft.de (Andreas Schmitz)
Subject: Re: Perl idiot needs help with simple script
Message-Id: <3b969c1f.2556903@news.btx.dtag.de>
On 5 Sep 2001 14:03:36 -0700, owl@theowls.co.uk (Rich Daley) wrote:
>#!/usr/bin/perl
>
>use CGI;
please start everything with
#!/usr/bin/perl -wT
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
then go on with
my $q = new CGI;
>$sendmail = "/usr/sbin/sendmail -n -t -oi";
>$to = "owl\@theowls.co.uk";
change to
see below....
>sub set_form_vars {
my $email = $q->param('email');
>}
>sub send_email {
open(SENDMAIL, "| /usr/sbin/sendmail -n -t -oi") or
die "Couldn't open sendmail: ";
print SENDMAIL <<EOF;
>From: $email
>To: $to
>Subject: Email Contact Form Response
>
>Form filled in by: $name ( $email )
>
>Company: $company
>Address:
>$address1
>$address2
>$town
>$county
>$postcode
>$country
>
>Phone: $phone Fax: $fax
>
>Their comments:
>$comments
>
>Should you contact them back: $contact
>How: by $how
>
>EOF
close MAIL or die "Something going wrong!";
>//}
--
Andreas Schmitz http://www.medialsoft.de
_ _ _ _ ° _ _ _ _ _
| | ||_ | \|| || _| (_)|- |
| | ||_ |_/||-||__
------------------------------
Date: 5 Sep 2001 21:58:50 GMT
From: abigail@foad.org (Abigail)
Subject: Re: pl or not pl, that is the question
Message-Id: <slrn9pd80j.hk3.abigail@alexandra.xs4all.nl>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMCMXXVI September
MCMXCIII in <URL:news:m1ofor84rc.fsf@halfdome.holdit.com>:
==
== (This is from <http://www.stonehenge.com/merlyn/UnixReview/col36.html>
== if you want to read more about it.)
==
== Extensions for scripts are *not needed*. Please stop it.
Neither are extensions for web documents. Yet people, including you,
use it, for whatever reason. You won't hear me pleading that you stop
doing so though.
Abigail
--
perl -wle'print"Κυστ αξοτθες Πεςμ Θαγλες"^"\x80"x24'
# An eagle in a cherry
# tree. A pair of bees crawl
# in a hazel.
------------------------------
Date: Wed, 05 Sep 2001 22:05:37 +0200
From: Crazydj <Crazydj@web.de>
Subject: Programming with pipes and fork
Message-Id: <3B968591.E22AF45F@web.de>
Hi @ll!!! =)
I have tried to program a little script that commiunicates via pipes
between a father and a child process, but I have a got a problem with
it. The father cannot talk to his son over the pipe! :-(
Here is the script mybe you could help be debugging it :-p
#!/usr/bin/perl
# Just a small script to test pipes and fork()
# 05.09.2001
$prozesse = 2;
$father->{'id'} = 'father';
# Testen einer generellen Pipe Communication
pipe OUT, IN or die "Cannot create pipe $!\n";
syswrite IN, "Hello dj";
sysread OUT, $data, 8;
print "$data\n";
# Prozesse erzeugen
for($i=1;$i<$prozesse;$i++)
{
($write,$read,$id) = child($father);
# Kind
if($id==0)
{
print "Creating child!\n";
$child = {'id' => $id,
'read' => $read,
'write' => $write};
}
else # Vater
{
print "Creating father!\n";
$father->{'id'} = $id;
$father->{'read'} = $read;
$father->{'write'} = $write;
}
}
# Test der Communication zwischen Vater und Kind
$talk = $father->{'write'};
$hear = $child->{'read'};
syswrite $talk, 'This is just a nice test';
sysread $hear, $testdaten, 24;
print "\nStille Post?!?!\n";
print "$testdaten\n\n";
# Unterprogramm um Kindprozesse zu erzeugen
sub child
{
$father = shift;
# Zwei Pipes anlegen (auf und ab)
pipe $write_up, $read_up or die "Cannot create pipe! $!\n";
pipe $write_down, $read_down or die "Cannot create pipe! $!\n";
$pid = fork();
die "Cant fork! $!\n" unless defined $pid;
# Vaterprozess
if($pid)
{
# Nicht benoetigte Pipes schliessen
close ($read_down,$write_up);
return $write_down, $read_up, $pid;
}
# Kindprozess
# Nicht benoetigte Pipes schliessen
close ($read_up, $write_down);
return $write_up, $read_down, $pid;
}
Lot of thanx! And best greets =)
Bastian Ballmann
--
Djz rule the world! ...and some other staff ;-p Find out at http://www.crazydj.de
------------------------------
Date: 5 Sep 2001 21:52:25 GMT
From: abigail@foad.org (Abigail)
Subject: Re: references, slices, voodoo
Message-Id: <slrn9pd7kj.hk3.abigail@alexandra.xs4all.nl>
Bart Lateur (bart.lateur@skynet.be) wrote on MMCMXXVI September MCMXCIII
in <URL:news:0nc9pt8lddgrcf7hlvh24nvtko43778jqb@4ax.com>:
`` Walter Hafner wrote:
``
`` >> Note that the stupid 'unless $i == $j' no longer appears in modern
`` >> editions of the FAQ.
`` >
`` >why "stupid"?
``
`` Why indeed.
``
`` I think that at one time,
``
`` @array[2, 2] = @array[2, 2];
``
`` did fail, or at least, generated a warning.
I think not.
The Fisher Yates shuffle is more or less the code I passed on to Tom
(and which appears on CPAN). My code has never had the unless clause,
and it has always worked fine.
The 'unless' clause is a misguided attempt of optimization. I do remember
Randal once proposing this optimization (before it appeared in the FAQ;
I don't know whether Tom took it from Randal or derived it independently).
It's stupid because one is spending O (n) time to avoid doing swaps that
don't really swap - however, the expected number of such swaps is
sum_{i=1}^N 1/i
unbounded but in O (n^e) for all e > 0.
Abigail
--
perl -Mstrict -we '$_ = "goto Q.print chop;\n=rekcaH lreP rehtona tsuJ";Q1:eval'
------------------------------
Date: 5 Sep 2001 21:46:03 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Undef'ing multiple variables
Message-Id: <9n66er$l8l$1@towncrier.cc.monash.edu.au>
"H. Merijn Brand" <h.m.brand@hccnet.nl> writes:
>damian@cs.monash.edu.au (Damian Conway) wrote in news:9n4q4a$e2a$1
>@towncrier.cc.monash.edu.au:
>> Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de> writes:
>>
>> >> So is there, or isn't there, a way to undef multiple variables
>> >> at once?
>>
>> > Don't know any such built-in function. You can do:
>>
>> > map { undef $_ } ($a, $b, @c);
>>
>> Some people don't like to use C<map> in a void context.
>> An alternative would be:
>>
>> undef $_ for $a, $b, @c;
>what's wrong with
> ($a, $b, @c) = ();
Nothing. It depends which effect you want.
All I was pointing out was that C<undef $_ for ...> is cleaner than
C<map { undef $_ } ...>
Damian
------------------------------
Date: Wed, 05 Sep 2001 22:00:55 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Undef'ing multiple variables
Message-Id: <x7r8tlfgbf.fsf@home.sysarch.com>
>>>>> "DC" == Damian Conway <damian@cs.monash.edu.au> writes:
>> what's wrong with
>> ($a, $b, @c) = ();
DC> Nothing. It depends which effect you want.
DC> All I was pointing out was that C<undef $_ for ...> is cleaner than
DC> C<map { undef $_ } ...>
and i wish to point out that undef on aggregates is not what most people
want. it deletes the entire variable and means it needs more work to
reinstantiate it. assigning () to a hash or array is much cleaner and
easier to read.
i never like seeing undef used as a function with a variable as an
arg. i prefer using it bare and only for its value of undef.
and as someone else said, doing undef on a bunch of vars usually implies
a design flaw in the program. it is rare to need undef like that.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: 5 Sep 2001 11:20:08 -0700
From: scott@wlk.net (Scott Mears)
Subject: unique perl R&D opportunity in Houston
Message-Id: <db987b84.0109051020.40ad7990@posting.google.com>
Hi,
I have been retained by a major Energy Conglomerate in Houston that is
putting
together a Telecommunications start-up firm, backed by $50 billion in
market clout,
to find a Sr. Perl developer experienced in Java for building a real
time pricing
agent for Perl scripts. It will also involve customizing, and
adjusting existing code.
Get the Entreprenuerial Upside without the Start-Up Risk!
We have the ability to put together a very attractive package,
including extensive
relocation, if needed.
Would you be interested in looking at this?
Please reply,
Scott Mears
281.955.6700
scott@wlk.net
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1700
***************************************