[17131] in Perl-Users-Digest
Perl-Users Digest, Issue: 4543 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 6 21:05:30 2000
Date: Fri, 6 Oct 2000 18:05:09 -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: <970880709-v9-i4543@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 6 Oct 2000 Volume: 9 Number: 4543
Today's topics:
A Print Statement Problem <miketruejedi@hotmail.com>
Re: calculating CRC-32 of remote file? <bart.lateur@skynet.be>
Re: Can't lock error (Gwyn Judd)
Re: Code for Multiple Regression in Perl? (Eric Bohlman)
Re: Getting Current Directory info (David Efflandt)
Re: Help processing files in a directory <matt.stoker@motorola.com>
Re: Help processing files in a directory (Martien Verbruggen)
How do I get a cgi script to load a url <ben.graves@virgin.net>
Re: How do I get a cgi script to load a url <tony_curtis32@yahoo.com>
Re: How do I get a cgi script to load a url <flavell@mail.cern.ch>
Re: How do I get a cgi script to load a url <ben.graves@virgin.net>
Re: How to issue NT 'AT" Command from perl? <matt.stoker@motorola.com>
integer length limitation <greg.lindsay@level3.com>
Re: integer length limitation (Logan Shaw)
Re: integer length limitation (Logan Shaw)
Re: Netscape supports Perl ? (Martien Verbruggen)
Re: Not Entirely On Topic: Programming and math (Martien Verbruggen)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 7 Oct 2000 01:17:34 +0100
From: "Michael" <miketruejedi@hotmail.com>
Subject: A Print Statement Problem
Message-Id: <8rlq2j$4hh$1@newsg4.svr.pol.co.uk>
Hello,
This is my first posting to this group. As a relative beginner to
Cgi/Perl I am trying find out more about the rules of HTML 'Here' documents
as mine seem to be going wrong. I have produced HTML documents with CGI
before but now I am trying to insert more complicated HTML it doesnt work.
What are the basic things I should be looking out for that could stop the
script?
ie, symbols or white spaces.
In the following script ignore the perl but please look at the head of the
HTML as this seems
to be stopping the script from working. If I remove most of the Javascript
it works just fine....
should I be using a print statement on everyline instead?
Any comments would be gladly received!
Many Thanks
Michael
----------------------------------------------------------------------------
-----
#!/usr/bin/perl
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
# Load the FORM variables
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
open (MESSAGE,"| /usr/lib/sendmail -t");
# Format email header information
print MESSAGE "To: $FORM{submitaddress}\n";
if ($FORM{email} ne "") {
print MESSAGE "Reply-To: $FORM{email}\n";
}
# Write the actual email message
print MESSAGE "You have received a Newsletter request from Stockpots
Website.\n\n";
print MESSAGE "Please add the below address to the mailing list.\n\n";
if ($FORM{email} ne "") {
print MESSAGE "Email: $FORM{email}\n"; }
if ($FORM{reply} eq "yes") {
print MESSAGE "Dont forget to reply.\n\n"; }
print MESSAGE "-------------------------------------------\n";
close (MESSAGE);
# Thank the user and acknowledge
# the feedback
&thank_you;
}
sub thank_you {
print "Content-type: text/html\n\n";
print <<"HTML code";
<html>
<head>
<title>Stockpots Cookshops - Quality Kitchenware</title>
<META NAME="keywords"
content="stockpots,www.stockpots.co.uk,kitchenware,cookshop,westbourne,">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META NAME="Description" Content="Stockpots U.K. Online Cookshop offers a
Huge Range of Quality Kitchenware for the Home and Professional Chef.">
<META NAME="Author" Content="Email - webmaster@stockpots.co.uk ">
<META NAME="Robots" Content="ALL">
<META NAME="Rating" Content="General">
<style>
a:hover{color:red}
</style>
<script language="JavaScript">
<!--
if (navigator.appName == "Microsoft Internet Explorer") {
function click () {
if (event.button==2) {
alert('Copyright Stockpots 2000');
}
}
document.onmousedown=click
}
//--></script>
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;
for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc)
x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#FFFF99" topmargin="8" scroll="auto"
onLoad="MM_preloadImages('images/home.gif','images/cookshop.gif','images/kni
ve.gif','images/bakeware.gif','images/accessories.gif','images/wedding.gif',
'images/order.gif','images/stores.gif')">
<script language="JavaScript">
var message='Stockpots Cookshops';function tntstatus()
{window.status=message;timerID=setTimeout("tntstatus()",25);}</script><scrip
t
language="JavaScript"><!--
tntstatus();//--></script>
<div align="center">
<!--top table contain nested tables containing corner gifs 70 hi 760
wide-->
<table width="760" HEIGHT="70" border="0" bgcolor="#FFFF99"
CELLPADDING="0" CELLSPACING="0">
<tr>
<td width="16" bgcolor="#006699" valign="top" rowspan="2">
<div ><img src="images/topleftcorner.gif" width="10"
height="10"></div>
</td>
<td width="200" bgcolor="#006699" height="30" valign="bottom">
<div align="left"><font color="#FFFFFF" size="1" face="Arial"><a
href="termsandconditions.html"><img src="images/terms2.gif" width="100"
height="14" border="0"></a></font>
</div>
</td>
<td width="460" bgcolor="#006699" rowspan="2">
<center>
<img src="images/logo5ani2.gif" width="250" height="50">
</center>
</td>
<td width="55" bgcolor="#006699" rowspan="2"><font color="#FFFFFF"
size="1" face="Arial"> </font></td>
<td width="35" bgcolor="#006699" rowspan="2" >
<table width="35" border="0" height="70" CELLPADDING="0"
CELLSPACING="0">
<tr>
<td height="35" valign="top" width="35">
<div align="right"><img src="images/toprightcorner.gif"
width="10" height="10"></div>
</td>
</tr>
<tr>
<td height="35" valign="bottom" width="35">
<div align="right"><img src="images/botrightcorner.gif"
width="10" height="10"></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="200" bgcolor="#006699" height="40" valign="top"><font
color="#FFFFFF" size="1" face="Arial"><a
href="javascript:window.external.AddFavorite('http://www.stockpots.co.uk','S
tockpots Cookshops')"><img src="images/bookmark2.gif" width="100"
height="14" alt="Add To Favourites" border="0"></a></font></td>
</tr>
</table>
<!-- thin full table holds upleftcnr gif -->
<table width="760" border="0" CELLPADDING="0" CELLSPACING="0" >
<tr>
<td width="120" bgcolor="#006699" height="10"> </td>
<td width="260" valign="top" height="10" >
<div align="left"><img src="images/topleftcornerblu.gif" width="10"
height="10"></div>
</td>
<td width="288" height="10"> </td>
<td width="92" height="10"> </td>
</tr>
</table>
<!--middle table contain nested tables first contains navdata 330 hi 760
wide-->
<table width="760" border="0" height="330" CELLPADDING="0"
CELLSPACING="0">
<tr valign="top">
<td width="120" bgcolor="#FFFF99">
<table width="120" border="0" height="330" cellpadding="0"
cellspacing="0">
<tr bgcolor="#006699">
<td height="18">
<div align="center"><a href="#"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('Image6','','images/home.gif',1)"><img
name="Image6" border="0" src="images/homeOV.gif" width="90" height="18"
alt="Home Page"></a></div>
</td>
</tr>
<tr bgcolor="#006699">
<td height="18">
<div align="center"><a href="cookware.html"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('Image14','','images/cookshop.gif',1)"><img
name="Image14" border="0" src="images/cookshopUP.gif" width="90" height="18"
alt="Cookware Products"></a></div>
</td>
</tr>
<tr bgcolor="#006699">
<td height="18">
<div align="center"><a href="knives.html"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('Image15','','images/knive.gif',1)"><img
name="Image15" border="0" src="images/kniveUP.gif" width="90" height="18"
alt="Knives Selection"></a></div>
</td>
</tr>
<tr bgcolor="#006699">
<td height="18">
<div align="center"><a href="bakeware.html"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('Image16','','images/bakeware.gif',1)"><img
name="Image16" border="0" src="images/bakewareUP.gif" width="90" height="18"
alt="Bakeware Products"></a></div>
</td>
</tr>
<tr bgcolor="#006699">
<td height="18">
<div align="center"><a href="gadgets.html"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('Image17','','images/accessories.gif',1)"><img
name="Image17" border="0" src="images/accessoriesUP.gif" width="90"
height="18" alt="Kitchen Gadgets"></a></div>
</td>
</tr>
<tr bgcolor="#006699">
<td height="18">
<div align="center"><a href="wedding.html"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('Image18','','images/wedding.gif',1)"><img
name="Image18" border="0" src="images/weddingUP.gif" width="90" height="18"
alt="Wedding List Service"></a></div>
</td>
</tr>
<tr bgcolor="#006699">
<td height="18">
<div align="center"><a href="stores.html"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('Image20','','images/stores.gif',1)"><img
name="Image20" border="0" src="images/storesUP.gif" width="90" height="18"
alt="Store Location"></a></div>
</td>
</tr>
<tr bgcolor="#006699">
<td height="18">
<div align="center"><a href="order.html"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('Image19','','images/order.gif',1)"><img
name="Image19" border="0" src="images/orderUP.gif" width="90" height="18"
alt="Ordering Information"></a></div>
</td>
</tr>
<tr bgcolor="#006699">
<td height="15">
<div align="center"> </div>
</td>
</tr><tr bgcolor="#FFFF99">
<td height="14">
<div align="left">
<table width="120" border="0" height="14" cellpadding="0"
cellspacing="0">
<tr bgcolor="#006699">
<td width="60" valign="bottom" ><img
src="images/botleftcorner.gif" width="10" height="10"></td>
<td valign="bottom" width="60">
<div align="right"><img
src="images/botrightcorner.gif" width="10" height="10"></div>
</td>
</tr>
</table>
</div>
</td>
</tr>
<!--seperate 2 blue boxes -->
<tr bgcolor="#FFFF99">
<td height="7"></td>
</tr>
<!-- holds toptable-->
<tr bgcolor="#006699">
<td height="10">
<div align="center">
<table width="120" border="0" height="10" CELLPADDING="0"
CELLSPACING="0">
<tr>
<td valign="top">
<div align="left"><img src="images/topleftcorner.gif"
width="10" height="10"></div>
</td>
<td valign="top" >
<div align="right"><img
src="images/toprightcorner.gif" width="10" height="10"></div>
</td>
</tr>
</table>
</div>
</td>
</tr>
<!-- middle form data -->
<tr bgcolor="#006699">
<td height="50" valign="top">
<center>
<font size="1" color="#EAEAEA" face="Verdana">To receive our
newsletter
please enter your email address </font>
</center>
</td>
</tr>
<tr bgcolor="#006699">
<td height="80">
<!-- form contains table -->
<form method="post"
action="http://www.latchmoor.co.uk/cgi-bin/newsletter.cgi"
name="formletter">
<table width="120" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td > <center>
<input type="text" name="email" size="12">
</center></td>
</tr>
<tr>
<td > <img src="images/bakeware.gif" width="1"
height="3"></td>
</tr>
<tr>
<td valign="bottom"> <center>
<input type="submit" name="submitbutton"
value="SEND">
<input type="hidden" name="submitaddress"
value="stockpots@hotmail.com">
</center></td>
</tr>
</table>
</form>
</td>
</tr>
<!-- hold baseline table-->
<tr bgcolor="#006699">
<td height="10">
<table width="120" border="0" height="10" CELLPADDING="0"
CELLSPACING="0">
<tr>
<td valign="bottom">
<div align="left"><img src="images/botleftcorner.gif"
width="10" height="10"></div>
</td>
<td valign="bottom">
<div align="right"><img src="images/botrightcorner.gif"
width="10" height="10"></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="620" bgcolor="#FFFF99" cellpadding="0" cellspacing="0">
<!-- table that hold the bluegif up -->
<!-- main data will go in this table -->
<table width="635" border="0" height="140" cellspacing="0"
cellpadding="0">
<tr>
<td width="93" height="100" >
<div align="right"> </div>
</td>
<td width="456" height="140" cellspacing="0" cellpadding="0">
<center>
<img src="images/tempptopic2.jpg" width="270" height="100">
</center>
</td>
<td width="86" height="100" >
<center>
Robert these will change
</center>
</td>
</tr>
</table>
<!-- centre table for data -->
<table width="635" border="0" height="70" cellspacing="0"
cellpadding="0">
<tr>
<td width="27" height="70">
<center>
</center>
</td>
<td width="604" height="70">
<center>
<font face="Verdana" size="2">Welcome to the Stockpots
Online
shop. Establised in 1992 we operate nine outlets in the UK
supplying
kitchenware and speciality products to home chefs and
commercial
caterers.</font> <font face="Verdana" size="2">We have built
a
reputation of providing a huge range of quality products and
excellent
service to our customers both on the internet and in our
cookshops.</font>
</center>
</td>
<td width="4" height="70">
<center>
</center>
</td>
</tr>
</table>
<table width="635" border="0" height="15" cellspacing="0"
cellpadding="0">
<tr>
<td width="199" height="20" ></td>
<td height="20" width="244"></td>
<td width="192" height="20" ></td>
</tr>
</table>
<!--new table -->
<table width="635" border="0" height="115" cellspacing="0"
cellpadding="0">
<tr>
<td width="27" height="115" >
<div align="right"><font face="Verdana, Arial, Helvetica,
sans-serif" size="2"> </font>
</div>
</td>
<td width="65" height="115" >
<center>
</center>
</td>
<td width="460" height="115">
<center>
<img src="images/tempmiddle2.gif" width="270" height="100">
</center>
</td>
<td width="83" height="115">
<center>
these will change
</center>
</td>
</tr>
</table>
</td>
<td width="5">
<div align="left"></div>
</td>
</tr>
</table>
<!-- next full table -->
<table width="760" border="0" CELLPADDING="0" CELLSPACING="0" height="75"
:
<tr>
<td width="120" height="90"> </td>
<td width="29" valign="top" height="90" >
<div align="left"></div>
</td>
<td width="605" height="90">
<center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">Our
online
selection represents some of our most popular kitchen products and
includes
items unique to Stockpots. We have one of the largest collections
of
kitchenware in the UK and all our products are both practical and
sylish.
Our fully stocked shops carry modern designs including Global and
Circulon
and classics like Le Cruseut and Dualit. </font><font
face="Verdana, Arial, Helvetica, sans-serif" size="2">
</font>
</center>
</td>
<td width="10" height="90"> </td>
</tr>
</table>
<table width="760" border="0" CELLPADDING="0" CELLSPACING="0" height="115"
:
<tr>
<td width="212" height="125"> </td>
<td width="459" height="125" >
<center>
<img src="images/lecreusetselfstanding2.jpg" width="270"
height="100">
</center>
</td>
<td width="82" height="125" valign="middle">
<center>
these will change
</center>
</td>
<td width="7" height="115"> </td>
</tr>
</table>
<table width="760" border="0" CELLPADDING="0" CELLSPACING="0" height="70"
:
<tr>
<td width="120" height="85"> </td>
<td width="29" valign="top" height="85" >
<div align="left"></div>
</td>
<td width="605" height="85">
<center>
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">
Ordering
anything from our online range is simple and secure and for our UK
customers
postage is completely free. Our staff are always here to help
answer
any enquiries you may have about products and ordering. We
endeavour
to ship out your goods as soon as we receive your order. We hope
you
enjoy shopping at Stockpots Online.</font>
</center>
</td>
<td width="10" height="85"> </td>
</tr>
</table>
<table width="760" border="0" CELLPADDING="0" CELLSPACING="0" height="2" >
<tr>
<td width="120" height="2"></td>
<td width="29" height="2" >
</td>
<td width="605" height="2" valign="baseline">
<center>
<hr size="1" width="180" align="center">
<font face="Verdana, Arial, Helvetica, sans-serif"
size="2"></font>
</center>
</td>
<td width="10" height="2"></td>
</tr>
</table>
<table width="760" border="0" CELLPADDING="0" CELLSPACING="0" height="5" >
<tr>
<td width="120" height="5"></td>
<td width="29" valign="top" height="5" >
<div align="left"></div>
</td>
<td width="605" height="5" valign="top">
<center>
<font size="1" face="Arial" color="#666666"> © Copyright
Stockpots</font>
<font size="1" face="Arial" color="#666666">2000</font>
</center>
</td>
<td width="10" height="5"></td>
</tr>
</table>
</div>
</body>
</html>
HTML code
}
Thankyou.
------------------------------
Date: Fri, 06 Oct 2000 23:31:12 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: calculating CRC-32 of remote file?
Message-Id: <tunstsstrfo2csc4nfbia578g35rcakpoa@4ax.com>
phartog@my-deja.com wrote:
>I just started to learn CGI scripts, I wonder
>is there a script that can download a remote file
>and calculate its CRC-32?
Yes... you probably want the String::CRC module. Get it from
Activestate's website for the Windows version (subdir /packages; be sure
to look in the directory compatible with your Perl version), and from
CPAN if you want it on a Unixy system.
--
Bart.
------------------------------
Date: Sat, 07 Oct 2000 00:46:36 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Can't lock error
Message-Id: <slrn8tssja.9h7.tjla@thislove.dyndns.org>
I was shocked! How could Smitty <jpsmith@mediom.qc.ca>
say such a terrible thing:
>I'm sorry to be an inexperienced group user...
>Here is the problem I have:
>The perl routine is:
>
>open (FILE, ">>$data") || die "I can't open $data\n";
>if ($useflock) {
>flock (FILE, 2) or die "can't lock data file\n";
>}
>
>The error generated is :
>
>Content-type: text/html
>The following error occurred : can't lock data file
You should include the $! variable in your die() statement so you can
get an idea of what went wrong:
flock (FILE, 2) or die "can't lock data file: $!";
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Hear about...
the new sorority girl doll?
You put a ring on her finger and her hips expand.
------------------------------
Date: 6 Oct 2000 22:06:49 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Code for Multiple Regression in Perl?
Message-Id: <8rlidp$2kr8$2@news.enteract.com>
lefkogt@my-deja.com wrote:
> Greetings
> (1) How daunting is the task of programming in Perl a multiple
> regression with four predictor variables and one criterion variable?
> The four variables are entered all at once.
> (2) Is there an existing Perl resource somewhere that has code for a
> multiple regression as mentioned above?
> Gary
Answering (2) first, go to <URL:http://search.cpan.org> and see if there
are any modules that could help. If not, (1) applies, and I'd suggest you
consult a reference on statistical computation; the "textbook" matrix
formula for solving a linear regression problem (B=(X'X)^1X'Y) is *not*
numerically stable (i.e. it's mathematically correct, but is very
susceptible to floating-point roundoff errors).
------------------------------
Date: Fri, 6 Oct 2000 23:57:39 +0000 (UTC)
From: efflandt@efflandt.xnet.com (David Efflandt)
Subject: Re: Getting Current Directory info
Message-Id: <slrn8tspoi.2hl.efflandt@efflandt.xnet.com>
On Fri, 06 Oct 2000, Ben@sebborn.f9.co.uk <Ben@sebborn.f9.co.uk> wrote:
>
>I need to get the name of the current directory a user is in, for a
>navigation system.
>
>I think the best way is to use $ENV{REQUEST_URI}
>
>How can I convert www.domain.com/directory/page.ext
The system and URL paths "might" be partly similar, but could be entirely
different. Why not use a variable that has the info you are looking for
in the first place? This can vary be server and server version, but if
you print all the env variables, I am sure you could find something.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
------------------------------
Date: Fri, 06 Oct 2000 15:28:28 -0700
From: Matthew Stoker <matt.stoker@motorola.com>
Subject: Re: Help processing files in a directory
Message-Id: <39DE520C.62E383D0@motorola.com>
Martien Verbruggen wrote:
>
> On Thu, 05 Oct 2000 19:27:15 -0700,
> Matthew Stoker <matt.stoker@motorola.com> wrote:
> > You can use:
> >
> > @files = <*.mp3>;
> >
> > or
> >
> > @files = glob *.mp3;
>
> You better make that
>
> @files = glob '*.mp3';
>
> if you want your program to compile.
Sorry about that. I tested the <*.mp3> case, but didn't bother with
glob. May the usenet gods beat me with a wet noodle.
>
> And I generally don't advocate the use of globbing, but recommend
> opendir and readdir instead [1]. On perl 5.6.0 and above that's less
> strong, but I still feel it's better to use system calls.
>
> Martien
>
> [1] I know you gave alternatives, but IMO they were not the right ones
I won't argue that opendir and readdir don't have advantages, but
sometimes <*> is just plain easier. The real reason I posted this
solution is because <*> is a bit hard to discover for a newbie (try
searching the man pages for <*>) and it's a useful tool to have. Of
course like all tools, you should learn their limitations and use the
proper tool for the job(you can use a screwdriver to drive a nail, but I
wouldn't recommend it).
--
/------------------------------------------------------------------\
| Matt Stoker | email: matt.stoker@motorola.com |
| Unit Process Modeling | Mail Drop: M360 |
| DigitalDNA(TM) Laboratories| Phone: (480)655-3301 |
| Motorola, SPS | Fax: (480)655-5013 |
| 2200 W Broadway Road | Pager: (888)699-8803 |
| Mesa, AZ 85202 | |
\------------------------------------------------------------------/
------------------------------
Date: Sat, 7 Oct 2000 11:43:24 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Help processing files in a directory
Message-Id: <slrn8tssdc.jr6.mgjv@martien.heliotrope.home>
On Fri, 06 Oct 2000 15:28:28 -0700,
Matthew Stoker <matt.stoker@motorola.com> wrote:
> Martien Verbruggen wrote:
>
> >
> > And I generally don't advocate the use of globbing, but recommend
> > opendir and readdir instead [1]. On perl 5.6.0 and above that's less
> > strong, but I still feel it's better to use system calls.
> >
> > Martien
> >
> > [1] I know you gave alternatives, but IMO they were not the right ones
>
> I won't argue that opendir and readdir don't have advantages, but
> sometimes <*> is just plain easier. The real reason I posted this
> solution is because <*> is a bit hard to discover for a newbie (try
> searching the man pages for <*>) and it's a useful tool to have. Of
> course like all tools, you should learn their limitations and use the
> proper tool for the job(you can use a screwdriver to drive a nail, but I
> wouldn't recommend it).
And, I generally also believe that the use of the diamond operator for
globbing is evil :). Seriously. I think people should, unless they're
playing golf, just use glob. It's simply more clear, and it doesn't
unnecessarily use a very common operator for another reason than people
might think is is being used.
The reason I tend to avoid recommending glob is precisely its
limitations, and its unportability. Depending on your version or Perl,
your platform, environment, and the behaviour of the shell that gets
invoked, the result is different. Perl 5.6.0 solves that by
internalising the code, but I don't feel like having to explain that
every single time glob comes up. opendir and readdir are consistent, and
they don't need to spawn external programs on older perls.
As far as I am concerned, glob should only be used in one-liners, or
very short code, like a little tool that is never going to be used
anywhere else than the task and platform fow which it was written.
Or, your program should contain
require 5.6.0;
close to the start. And even then you should use glob, not <>.
Perl can be a very portable language. Why ruin it?
Martien
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++
Commercial Dynamics Pty. Ltd. | Reinstall Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Sat, 7 Oct 2000 00:38:13 +0100
From: "Ben Graves" <ben.graves@virgin.net>
Subject: How do I get a cgi script to load a url
Message-Id: <IntD5.18579$L12.374372@news2-win.server.ntlworld.com>
I know that it is possible to get a perl script to send HTML back to the
users web browser after or during its execution but how do I get the script
to direct the users browser to a url once it has finished executing instead?
What I would like the script to be able to do is,
1) Recieve data from a form
2) Process the data
3) Send the users browser to a url.
------------------------------
Date: 06 Oct 2000 18:44:18 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <87hf6p1qnh.fsf@limey.hpcc.uh.edu>
>> On Sat, 7 Oct 2000 00:38:13 +0100,
>> "Ben Graves" <ben.graves@virgin.net> said:
> What I would like the script to be able to do is,
> 1) Recieve data from a form
> 2) Process the data
> 3) Send the users browser to a url.
perldoc CGI
redirect()
hth
t
--
Namaste!
And an "oogabooga" to you too!
-- Homer Simpson
------------------------------
Date: Sat, 7 Oct 2000 01:49:43 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <Pine.GHP.4.21.0010070145090.11770-100000@hpplus03.cern.ch>
On Sat, 7 Oct 2000, Ben Graves wrote:
> I know that it is possible to get a perl script to send HTML back to the
> users web browser after or during its execution but how do I get the script
> to direct the users browser to a url once it has finished executing instead?
What use have you made of the FAQs that come with every Perl
installation?
The answer given there isn't ideal (to the extent that I submitted a
documentation bug report about it), but it's sure better than where
you appear to be currently.
perldoc -q redirect
http://ppewww.ph.gla.ac.uk/~flavell/www/perlcgifaq.html
------------------------------
Date: Sat, 7 Oct 2000 01:46:27 +0100
From: "Ben Graves" <ben.graves@virgin.net>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <FnuD5.17843$uq5.351578@news6-win.server.ntlworld.com>
How does this work?
I have tried,
redirect('http://www.bbc.com');
but this results in a server error.
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87hf6p1qnh.fsf@limey.hpcc.uh.edu...
> >> On Sat, 7 Oct 2000 00:38:13 +0100,
> >> "Ben Graves" <ben.graves@virgin.net> said:
>
> > What I would like the script to be able to do is,
>
> > 1) Recieve data from a form
> > 2) Process the data
> > 3) Send the users browser to a url.
>
> perldoc CGI
>
> redirect()
>
> hth
> t
> --
> Namaste!
> And an "oogabooga" to you too!
> -- Homer Simpson
------------------------------
Date: Fri, 06 Oct 2000 15:49:04 -0700
From: Matthew Stoker <matt.stoker@motorola.com>
Subject: Re: How to issue NT 'AT" Command from perl?
Message-Id: <39DE56E0.D54E7B08@motorola.com>
princekr@acwilm.com wrote:
>
> I am new at this and have searched for an answer tio this question in
> FAQ's and the Camel book.
>
> Can someone show me how to issue an NT command from perl.
>
> I am using the Active State build 522 which is perl 5.005_03
>
Not sure about the specifics on NT, but the man pages for the following
will probably help:
system
exec
backticks (the backward apostrophes ->``<- located to the left of the 1
key on most keyboards)
also see perlfaq8
Good luck!
--
/------------------------------------------------------------------\
| Matt Stoker | email: matt.stoker@motorola.com |
| Unit Process Modeling | Mail Drop: M360 |
| DigitalDNA(TM) Laboratories| Phone: (480)655-3301 |
| Motorola, SPS | Fax: (480)655-5013 |
| 2200 W Broadway Road | Pager: (888)699-8803 |
| Mesa, AZ 85202 | |
\------------------------------------------------------------------/
------------------------------
Date: Fri, 6 Oct 2000 16:52:42 -0600
From: "Greg Lindsay" <greg.lindsay@level3.com>
Subject: integer length limitation
Message-Id: <39de57cb$0$25501@news.denver1.Level3.net>
I'm trying to execute a modulus on a number, but keep coming up with the
wrong answer. The only thing I can think of is that the number is being
truncated because it's too big. How do I tell perl to keep the entire
number instead of expressing it as 3.37587917446654e+35? I need the exact
number in order to determine the modulus. Here's what I'm doing:
sub calc {
# This calculates the output
$P = $input{'P'};
$Q = $input{'Q'};
$mod = $P*$Q;
$E = $input{'E'};
$D = $input{'D'};
$X = $input{'X'};
$exp = $X**$E;
$enc = $exp % $mod;
}
$P = 61
$Q = 53
$E = 17
$X = 123
$PQ = mod = 3233
$exp = 123^17 = 337587917446653715596592958817679803
$enc = $exp mod 3233 = 855
But, I keep coming up with 1154 instead of 855. I think it's because $exp
is being stored incorrectly, probably as
337587917446654000000000000000000000.
Is this number too big for perl to handle?
Greg Lindsay
greg.lindsay@level3.com
------------------------------
Date: 6 Oct 2000 18:26:50 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: integer length limitation
Message-Id: <8rln3q$cit$1@provolone.cs.utexas.edu>
In article <39de57cb$0$25501@news.denver1.Level3.net>,
Greg Lindsay <greg.lindsay@level3.com> wrote:
>I'm trying to execute a modulus on a number, but keep coming up with the
>wrong answer. The only thing I can think of is that the number is being
>truncated because it's too big. How do I tell perl to keep the entire
>number instead of expressing it as 3.37587917446654e+35?
Perl is using your system's built-in floating point type. Floating
point types store numbers as a mantissa and an exponent, with a fixed
precision for each one. They do this so you can store large numbers
without needing to use more than a fixed number of bits (32 or 64,
usually).
What you want is some sort of "bignum" package, i.e. a way to make Perl
know how to deal with numbers that have arbitrarily large precision. I
believe the PDL package has this ability; have a look at
http://pdl.perl.org/ . There may be other packages available to do the
same or similar things -- you might try searching on
http://search.cpan.org/ .
Hope that helps.
- Logan
------------------------------
Date: 6 Oct 2000 18:28:20 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: integer length limitation
Message-Id: <8rln6k$cjk$1@provolone.cs.utexas.edu>
In article <8rln3q$cit$1@provolone.cs.utexas.edu>,
Logan Shaw <logan@cs.utexas.edu> wrote:
>What you want is some sort of "bignum" package, i.e. a way to make Perl
>know how to deal with numbers that have arbitrarily large precision.
Doh! I just realized (a second after hitting "post", of course) that
Perl includes this. Try "perldoc Math::BigInt".
- Logn
------------------------------
Date: Sat, 7 Oct 2000 10:20:30 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Netscape supports Perl ?
Message-Id: <slrn8tsnhu.jr6.mgjv@martien.heliotrope.home>
On Fri, 6 Oct 2000 09:47:45 +0530,
Pratibha Sundarmurthy <Pratibha.S@in.bosch.com> wrote:
> Hello,
> I am using ActiveState's Activeperl to develop ASP pages.
> The pages don't work on netscape...does anyone know if anything has to be
> installed/copied to work with netscape ?
If the stuff you generate works on something else than Netscape, but not
on Netscape, then it's not a Perl problem. If your program executes, and
produces the output you requested, then it's not a Perl problem.
To discuss browsers specific stuff, go to one of the
comp.infosystems.www.* groups.
> any info is appreciated.
Pleasure to be of help.
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use
NSW, Australia | being a damn fool about it.
------------------------------
Date: Sat, 7 Oct 2000 11:54:45 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Not Entirely On Topic: Programming and math
Message-Id: <slrn8tst2l.jr6.mgjv@martien.heliotrope.home>
[Post edited to conform to my killfile entries. No mention of certain
people allowed! Not even by cutesie nicknames.]
On Fri, 06 Oct 2000 19:13:43 GMT,
Uri Guttman <uri@sysarch.com> wrote:
> >>>>> "JS" == Jonathan Stowe <gellyfish@gellyfish.com> writes:
>
> JS> On Thu, 05 Oct 2000 13:21:41 -0400 Lou Moran wrote:
> >> --Is a strong background in mathematics (not arithmetics) mandatory
> >> for a successful career as a programmer?
> >>
> >> --Could a creative (musician/writer/painter/whatever) person become a
> >> "real" (read useful/good/paid) programmer without having mathematical
> >> prowess?
>
> JS> Yes, I have a degree in English Literature.
>
> which proves the point of needing a math degree to be a programmer.
>
> <but then again XXXXXXXXXX claims an english phud which is a counter point>
The statement 'All good programmers have mathematical prowess', and your
(implied) conjecture that somehow english literature is mathematical, do
not mean that anyone with an english degree should therefore be a good
programmer.
Mathematics includes logic, doesn't it? :)
Martien
PS. None of this means that I agree with any of these statements anyway.
In fact, I don't. But I'm not going to discuss it here. comp.programming
might be a better place.
--
Martien Verbruggen |
Interactive Media Division | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
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 4543
**************************************