[7437] in Perl-Users-Digest
Perl-Users Digest, Issue: 1062 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 23 07:07:25 1997
Date: Tue, 23 Sep 97 04:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 23 Sep 1997 Volume: 8 Number: 1062
Today's topics:
Re: A Complex Regex Needed (Eric)
Re: Calculating the week number <lth@dannet.dk>
cgi data <asmr@antispam.edu>
Re: CGI.pm 2.36 -- passing a cookie to a 2nd form (Martien Verbruggen)
Convert::EBCDIC <leachcj@bp.com>
Converting encoded strings barman@cs.unc.edu
Deleting Files <capulet16@hotmail.com>
Re: Deleting Files <eike.grote@theo.phy.uni-bayreuth.de>
Re: Exponential Calculation Problems (Tad McClellan)
help for new man <mysun@mbox2.singnet.com.sg>
Re: importing comma deliniated - I'm stuck! (Eric)
Re: Need a script to replace a link with the web page i stephen_benson@watsonwyatt.co.uk
Re: Need help with pesky warning... (Tad McClellan)
Re: Need help with pesky warning... (Tad McClellan)
Re: Need help with pesky warning... (Dave Schenet)
Re: Perl <-> RPC <-> C <ghowland@hotlava.com>
Perl Newbie needs help again (Paul Scott)
Re: Perl on standalone NT 4.0 server (Mike King)
Re: perl/win95/Long File Names (Eric)
Re: Ret Value from Opened Pipe <seay@absyss.fr>
setsockopt (solving 'address already in use' error) (Davor Cubranic)
Re: Uploading files larger than 50k from webpage IMPOSS (Gvran Lvfstrvm)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Sep 1997 04:05:15 GMT
From: pojo@gte.net.nospam (Eric)
Subject: Re: A Complex Regex Needed
Message-Id: <607f5r$cli$1@gte1.gte.net>
On Wed, 27 Aug 1997 09:49:14 +0200, Doug Seay <seay@absyss.fr> wrote:
>Christopher Stetson wrote:
>>
>> Hi All,
>>
>> I am trying to write a match-oriented regex that is taking a tab
>> delimited set of fields as the target operand and trying to match it
>> with a regex that is looking at various fields for a matchs.
>>
>> E.G.:
>>
>> Fields | Movie Name Actor Name Director Name Category
>> Record 1 | Big \t Tom Hanks \t Penny Marshall \t Comedy
>>
>> The regex needs to look for "Big" and "Penny" in the exact fields and no
>> others and the regex should do it in one fell swoop (no splitting).
>
>Why "no splitting"? Has split tormented you in the past and you have
>now black listed it?
>
>my ($film, $director) = ( split(/\t/, $record) )[0,2];
>
>But since you want a RE, that would be
>
>$record =~ m/([^\t]+)\t+[^\t]+\t+([^\t]+);
Shouldn't this be m/([^\t]*)\t+[^\t]*\t+([^\t]*) in order to account for
blank fields in the database?
>my ($film, $director) = $1, $3;
>
>- doug
------------------------------
Date: Tue, 23 Sep 1997 08:17:44 +0200
From: Lars Thegler <lth@dannet.dk>
To: Bjorn <bjorn@earthcorp.nn.se>
Subject: Re: Calculating the week number
Message-Id: <34275F08.919A7318@dannet.dk>
You'll get off easiest by using the Perl module Date::DateCalc:
http://reference.perl.com/module.cgi?Date::DateCalc
This includes week-number calculation according to ISO 2015.
Bjorn wrote:
>
> I need a piece of code for calculating the current week. I checked the
> perl FAQ, but the formula there doesn't work (unless you're on a year
> that starts with monday and don't care about the last week being
> correct). Any help would be greatly appreciated...
--
Lars Thegler mailto:lth@dannet.dk
Internet Development http://www.dannet.dk
Dan Net A/S phone: +45 45 82 16 00
Blokken 9 - DK-3460 Birkeroed - Denmark fax: +45 45 82 16 44
------------------------------
Date: Mon, 22 Sep 1997 23:36:27 -0400
From: asmr <asmr@antispam.edu>
Subject: cgi data
Message-Id: <3427393A.58A7@hotmail.com>
Under normal circumstances I would take the time to learn how to do this
myself, but unfortunately time constraints have forced me to get a
project done as quickly as possible.
I'm creating a perl script that will allow users to access information,
as long as the identification number entered is valid. I have a list of
the valid id numbers in a file, and the data is structured as follows:
123456789
234567891
098765432
and so on for a list of aprox. 200 numbers. I need to check the user
input of their ID and see if it appears in the data file. If anyone
could crank out the few lines of code I need it would save me a
considerable amount of time. (to make things easier to explain, i've
called the user entered id number "input{'id'}" and the data text file
"data.txt")
Thanks in advance! :)
Allison Conover
conov@hotmail.com
------------------------------
Date: 23 Sep 1997 03:20:53 GMT
From: mgjv@mali.comdyn.com.au (Martien Verbruggen)
Subject: Re: CGI.pm 2.36 -- passing a cookie to a 2nd form
Message-Id: <607cil$689$1@comdyn.comdyn.com.au>
In article <slrn62ddug.ren.awm@luers.qosina.com>,
awm@luers.qosina.com (Aram Mirzadeh) writes:
> ...
...
> Not an ARRAY reference at (eval 21) line 12.
>
> The offending line is here:
...
> print start_form($method,$action,$encoding);
> print hidden(-name=>'sample',
> -value=>\%parts);
...
> Where %parts is the array. I can print this array out:
%parts is not an array, it's a hash. \%parts therefore is a HASH
%reference. You'll have to use a real array.
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Tue, 23 Sep 1997 18:20:49 +1000
From: Chris Leach <leachcj@bp.com>
Subject: Convert::EBCDIC
Message-Id: <34277BE1.2D7F904B@bp.com>
Convert::EBCDIC has been uploaded to PAUSE and should be avaiable
at a CPAN site near you soon.
If you are interested please try. Comments and Suggestion are can
be sent to the author.
Regards,
Chris Leach
NAME
Convert::EBCDIC, ascii2ebcdic, ebcdic2ascii - Perl module for
string conversion between EBCDIC and ASCII
SYNOPSIS
use Convert::EBCDIC;
$ascii_string = ebcdic2ascii($ebcdic_string);
$ebcdic_string = ascci2ebcdic($ascii_string);
$translator = new Convert::EBCDIC;
$translator = new Convert::EBCDIC($table);
$ascii_string = $translator->toascii($ebcdic_string);
$ebcdic_string = $translator->toebcdic($ascii_string);
$Convert::EBCDIC::ccsid819
DESCRIPTION
This module can be used to import then functions ascii2ebcdic
and/or ebcdic2ascii or in an Object mode.
Exported Functions:
ascii2ebcdic()
takes as the first argument a EBCDIC string that is to be
converted to ASCII using default converion table.
ebcdic2ascii()
takes as the first argument a ASCII string that is to be
converted to EBCDIC using default converion table.
Object methods:
new()
creates a new translator object. Will take an optional
argument being a 256 character conversion table.
toascii()
takes and ASCII string and return and EBCDIC string.
toebcdic()
takes and EBCDIC string and return and ASCII string.
Translation tables:
$Convert::EBCDIC::ccsid819
Character Code Set ID 00819. This is the default.
PORTABILITY
This module should work on any system with Perl 5. Tested under
SPARC Solaris and AS400/OS400 RISC.
AUTHOR
Chris Leach <leachcj@bp.com>.
------------------------------
Date: Mon, 22 Sep 1997 23:41:05 -0600
From: barman@cs.unc.edu
Subject: Converting encoded strings
Message-Id: <874989447.14509@dejanews.com>
I have a similar question to the one posted below. How
do I remove the hex representation of special characters?
I have a string,
$_ = "Here%27s An Example"
and want it to be simply
"Here's An Example".
What hex or ord operators do I need to use to substitute? Thanks!
>From: tadmc@flash.net (Tad McClellan)
>Date: 1997/09/11
>Message-Id: <pqm8v5.hs.ln@localhost>
>Newsgroups: comp.lang.perl.misc
>[More Headers]
>
>Parillo (lparillo@newshost.li.net) wrote:
>: Will you have to do a printf in order to get the leading zeros?
>: BTW, the perldoc on printf and sprintf is not helpful to non-c
>: programmners. Is there a better source (other than deja news?)
>
>
>The perlfunc man page for 5.004 has a description under sprintf() that
>is not in earlier versions:
>
>
>----------------------------------------
>=item sprintf FORMAT, LIST
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 23 Sep 1997 17:59:05 +1000
From: Melinda <capulet16@hotmail.com>
Subject: Deleting Files
Message-Id: <342776C9.3D10@hotmail.com>
Can anyone tell me how to delete a file ?
I am writing a homepage designer and have created a temp file while the
page is being designed. My present solution is to make the file size
equal to 0 bytes but it's an untidy way of doing things. Also if anyone
uploads new picture files I want to delete others of their choice as I
have set limits on total space for the image directory.
I know it must be a simple solution but as yet the answer to doing it
has eluded me.
Hope to hear from someone out there,
Warren
------------------------------
Date: Tue, 23 Sep 1997 10:18:22 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Deleting Files
Message-Id: <34277B4E.2781@theo.phy.uni-bayreuth.de>
Hi,
Melinda wrote:
>
> Can anyone tell me how to delete a file ?
Use 'unlink()' (described on the "perlfunc" manual page).
Bye, Eike
--
======================================================================
Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
e-mail -> eike.grote@theo.phy.uni-bayreuth.de
WWW -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html
http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================
------------------------------
Date: Mon, 22 Sep 1997 22:40:27 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Exponential Calculation Problems
Message-Id: <bnd706.904.ln@localhost>
Rod Moore (rodm@studiopointe.com) wrote:
: I am trying to figure out how to calculate a number with an exponent.
^^^^^^^^
: HELP! (I know someone will have the answer to this easy question)
^^^^^^^
That someone is you, assuming you have a proper perl installation.
A word search for 'exponent' in the free documentation that is included
with the perl distribution will answer this question in about ten seconds...
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 23 Sep 1997 08:09:35 GMT
From: "David" <mysun@mbox2.singnet.com.sg>
Subject: help for new man
Message-Id: <01bcc7f8$0de8aae0$371c09a8@WeiXiao.income.com.sg>
Hi, all there,
I am a new man in perl programming, I have a simple problem as follows:
(ScriptFileName.pl)
print <<"END_1";
Content-type: text/html
<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
</HEAD>
<BODY>
H1>Greetings,World!<H1>
</BODY>
</HTML>
END_1
When I execute this perl script (at dos command prompt, execute perl
ScriptFileName,pl) a error message appears:
Can't find string terminator "END_1" anywhere befor EOF as
ScriptFileName,pl line 1.
I use perl for win32 Build 310 under windows95.
Any suggestion and comment will be approciated. Thanks
------------------------------
Date: 23 Sep 1997 04:25:41 GMT
From: pojo@gte.net.nospam (Eric)
Subject: Re: importing comma deliniated - I'm stuck!
Message-Id: <607gc5$n6m$1@gte1.gte.net>
On Tue, 26 Aug 1997 22:39:57 GMT, zatezalo.2@osu.edu (Shane) wrote:
>Ok, I'm stuck! I tried the code in the FAQ. I tried old code from old posts.
>No luck.
>
>I'm trying to read-in data from a comma deliniated file. Its from a huge
>Access 7.0 database. I'm trying to import the data into a new
>SQL database.
>
>The file's format is as follows:
>
>"Last","First","MI","HISusrNAME","DeptEmailAddress","Fax","Location",
>"Pager","Phone","Position","B-day","HISEmailAddress","ID#"
>
>A snippet of the file looks like this:
>
>"Miller","John","E",mill02,"mill","688-6666",,"770-7777","293-33332","Human
>Resources",6/23/71 0:00:00,"mill@bob.com","222-333-4444"
>"Zatezalo","Shane","M",zate01,"Zatezalo@fam10.med","293-4444","ALL","626-4444","
>293-4444","LAN-Computers",3/01/40 0:00:00,"zate@bob.com","222-333-4445"
>
>The problem is that any variable that does NOT have quotes around it screws
>the program up. And in the real database, there are quite a few of these.
>There are also entries that will be blank (notices the 6666",, from the first
>entry in the text file).
>
>The code is below. I seperated the two methods I found from the faq/previous
>posts into subs, to mess with both, yet be convenient while in emacs.
>
>Any help appreciated....
I found the code in the FAQ (splitting fields on commas except when
quoted) to be buggy for my purposes, which was to split WHITESPACE delimited
fields, except when quoted:
@words= ();
push(@words, $+) while $dataline =~ m{(\"[^\"]*\"){1}|([^\s\"]+)}gx;
I'd imagine changing this to:
@words= ();
push(@words, $+) while $dataline =~ m{(\"[^\"]*\"){1}|([^\,\"]+)}gx;
would work well for you. Although the second matching term won't match
the 2nd field below:
"Hi there",this is a "test", goodbye!,end
Perhaps the following would be better. Try it on a test data file with
every combination of quotes, no quotes, commas and spacing you think you might
encounter:
@words= ();
push(@words, $+) while $dataline =~ m{(\"[^\"]*\"){1}|([^\,]+)}gx;
DISCLAIMER: I've only been doing Perl about a month now.
-- Eric
------------------------------
Date: Tue, 23 Sep 1997 03:33:29 -0600
From: stephen_benson@watsonwyatt.co.uk
To: stephenb@scribendum.win-uk.net
Subject: Re: Need a script to replace a link with the web page it points to
Message-Id: <874927721.11286@dejanews.com>
> > I have a project where pages refer to notes held in other pages;
what
> > I have to do is generate (if possible on the fly, but not
necessarily)
> > versions for print which include these pages, expanding them
inline.
>
> > I've beem dabbling in Perl and Javascript, but I'[m a novoce, and
I'd
> > appreciate tips on how to go about it, and which lang to use.
>
> Use Perl; it'll be easier than doing it in Javascript (if it's even
> possible in Javascript). There are modules on CPAN which can help.
Yup.. I figured Perl for the job, although I think Javascript could do
it, by
rewriting the page client side.
I'm checking the perl modules, especially libwwww, which has the http
get/simple
getfunction -- but I think I'm going to have to update my perl (I'm
running the
Activeware version 5.003_07) with the new Gurusamy Sarathy binary
first, so I
can use the Martin Cleaver script to run libwww-perl on my W95/NT4
machines. I
think, I'm still trying to work the version/compatibility thing
out......
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Mon, 22 Sep 1997 22:49:26 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Need help with pesky warning...
Message-Id: <68e706.904.ln@localhost>
David S. Patterson (david.s.patterson@boeing.com) wrote:
: I am trying to figure out how to avoid getting run-time
: warnings when executing the following program:
: #!/usr/local/bin/perl_5.003 -w
: open (FP1, "mydata.txt");
: while (<FP1>)
: {
: chop;
safe chomp() would be... well... safer ;-)
: m/^(\w+ +\w+) +(\w{10})(\w{10})?(\w{10})?/;
: print "[$1] [$2] [$3] [$4]\n";
print "[$1] [$2]";
print " [$3]" if $3;
print " [$4]" if $4;
print "\n";
: }
: Here is mydata.txt:
: 7X7AA 286T0018001 0000200010
: 7X7AA 286T0018002 0000200010
: 7X7AA 286T0020001 000360003900041000460005099999
: 7X7AA 286T0020101 00001000250005000488
: 7X7AA 286T0020102 00001000250005000488
: 7X7AA 286T0033103 000010003200034000350005100120
: The problem is that when this program is run with
: the -w switch, I get a bunch of "Use of uninitialized
: value at ..." warnings whenever there is no data
: for the third or fourth matches. Everything seems
: to work fine, including the null values for $3 and $4;
: All of the exhibited behavior of the program seems
: to be defined by perl's programming rules, to the
: best of my knowlege.
: Should I 1) Approach this problem using a different methodology?
Nope.
: 2) Ignore the warnings and run with -w off?
^^^^^^^^^^^^^^^
Most definitely not!
: 3) RTFM?
Not really required this one time ;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 22 Sep 1997 23:04:29 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Need help with pesky warning...
Message-Id: <d4f706.h44.ln@localhost>
I myself wrote:
: print " [$3]" if $3;
Uhhh, better make that:
print " [$3]" if defined($3); # ;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 23 Sep 1997 02:39:48 GMT
From: shodan@shodan.erols.com (Dave Schenet)
Subject: Re: Need help with pesky warning...
Message-Id: <607a5k$ijo@winter.news.erols.com>
David S. Patterson (david.s.patterson@boeing.com) wrote:
: Howdy,
: I am trying to figure out how to avoid getting run-time
: warnings when executing the following program:
: #!/usr/local/bin/perl_5.003 -w
: open (FP1, "mydata.txt");
: while (<FP1>)
: {
: chop;
: m/^(\w+ +\w+) +(\w{10})(\w{10})?(\w{10})?/;
: print "[$1] [$2] [$3] [$4]\n";
: }
[snip]
You could try putting your match in an if statement. i.e.
if (m/<your regex>/) { print "[$1] [$2] [$3] [$4]\n"; }
[snip]
--
+----------------------------------+-----------------------------------+
|Dave Schenet <shodan at erols com>| Erols Internet Services, INC. |
|Junior UNIX Developer | Springfield, VA. |
+----------------------------------+-----------------------------------+
| Can't reply by mail? I'm blocking 62 netblocks from sending me mail. |
| I have zero-tolerance for SPAM. One strike and I stop listening. . . |
+----------------------------------------------------------------------+
------------------------------
Date: Tue, 23 Sep 1997 10:10:07 +0200
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: Perl <-> RPC <-> C
Message-Id: <3427795F.6F39@hotlava.com>
Matthew Cravit wrote:
>
> In article <606a76$js6$1@node6.frontiernet.net>,
> Jared Evans <jared@node6.frontiernet.net> wrote:
>
> >I have designed a RPC service under C for both client and server sides. I'm
> >looking into the possiblity of using perl on the client side. Is it possible
> >for perl to communicate to a server written in C via RPC? What sort of
> >things would be involved?
You may want to take a look at the RPC.pm file at
http://www.hotlava.com/software/
It is my first attempt at implementing RPC in Perl. I have successfully
used this to monitor NFS connections. My long term goal was to write an
NFS server :-0
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: Tue, 23 Sep 1997 10:47:26 GMT
From: page@page-group.co.uk (Paul Scott)
Subject: Perl Newbie needs help again
Message-Id: <34279d7e.7080245@news.demon.co.uk>
Hi all,
I am attempting a simple email from a web page form script, and the
error msg I am geting when I debug has completely foxed me - can
anyone help?
ERROR MSG--------------------
Output of script follows:
=====================================================
path: '/cgi-bin/pageg/xx-oceandream.pl'
argv[0]: 'xx-oceandream.pl'
argv[1]: '<NULL>'
pageg... Recipient names must be specified
sendmail: setgroups: Operation not permitted
/wwwpublic/./v/p/a/g/pageg/dead.letter... cannot open: File exists
)... Unbalanced ')'
)... Unbalanced ')'
---------------------------------------------------------------------------
Script STDONE.PL----------------------------------------------------
#!/bin/perl
$mailprog = '/usr/lib/sendmail';
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
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;
}
1;
---------------------------------------------------------------------------
script STDTWO.PL---------------------------------------
#!/bin/perl
require "stdone.pl";
# If the comments are blank, then give a "blank form" response
#&blank_response unless $FORM{'email'};
# Now send mail to $recipient
open (MAIL, "|$mailprog $FORM{'Recipient'}") || die "Can't open
$mailprog!\n";
select (MAIL);
print "From: $FORM{'Email'}\n";
print "Reply-to: $FORM{'Name'} $FORM{'Company'})\n";
print "Email: $FORM{'Email'}\n";
print "Subject: $FORM{'SubjectEnquiry'} Enquiry\n\n";
print
"------------------------------------------------------------\n";
print "Subject of Enquiry: $FORM{'SubjectEnquiry'} Enquiry\n";
print "Subject Company: $FORM{'CompanyRecipient'}\n";
print "Name: $FORM{'Name'}\n";
print "Company: $FORM{'Company'}\n";
print "Email: $FORM{'Email'}\n";
print "Address 1: $FORM{'Address1'}\n";
print "Address 2: $FORM{'Address2'}\n";
print "Town/City: $FORM{'Town'}\n";
print "County: $FORM{'County'}\n";
print "Country: $FORM{'Country'}\n";
print "Post/Zip Code: $FORM{'PostCode'}\n";
print "Telephone: $FORM{'Tel'}\n";
print "Fax: $FORM{'Fax'}\n";
print "Sponsorship option: $FORM{'sponsor'}\n";
print "Amount: $FORM{'amount'}\n";
print "Week Choice One: $FORM{'week1'}\n";
print "Week Choice Two: $FORM{'week2'}\n";
print "Detail of Enquiry: $FORM{'DetailEnquiry'}\n";
print"-------------------------------------------------------------\n";
close (MAIL);
select (STDOUT);
print "Content-Type: text/html\n\n";
print "<Head><Title>Thank You for your $FORM{'EnquiryType'}
Enquiry</Title></Head>";
print "<Body><H3>Thank You for your $FORM{'EnquiryType'}
Enquiry.</H3>";
print "Thank you $FORM{'Name'} for your $FORM{'EnquiryType'} Enquiry.
Your enquiry as it was sent is displayed below. Please check it and if
any section is incorrect please resubmit the enquiry.<P>Return to the
<A HREF=\"$FORM{'HomePage'}\" >$FORM{'CompanyRecipient'} Home
Page.</a></p><br><br>";
print "From: $FORM{'Email'}<br>";
print "Reply-to: $FORM{'Name'} $FORM{'Company'})<br>";
print "Email: $FORM{'Email'}<br>";
print "Subject: $FORM{'EnquiryType'} Enquiry<br>";
print
"------------------------------------------------------------<br>";
print "Subject of Enquiry: $FORM{'EnquiryType'} Enquiry<br>";
print "Name: $FORM{'Name'}<br>";
print "Company: $FORM{'Company'}<br>";
print "Email: $FORM{'Email'}<br>";
print "Address 1: $FORM{'Address1'}<br>";
print "Address 2: $FORM{'Address2'}<br>";
print "Town/City: $FORM{'Town'}<br>";
print "County: $FORM{'County'}<br>";
print "Country: $FORM{'Country'}<br>";
print "Post/Zip Code: $FORM{'PostCode'}<br>";
print "Telephone: $FORM{'Tel'}<br>";
print "Fax: $FORM{'Fax'}<br>";
print "Detail of Enquiry: $FORM{'DetailedEnquiry'}<br>";
#if $FORM{'SubjectEnquiry'} ne '';
print"-------------------------------------------------------------<br>";
print "</BODY></HTML>";
---------------------------------------------------------------------------
------------------------------
Date: Tue, 23 Sep 1997 06:07:51 GMT
From: m.king.garbage@praxa.com.garbage.au (Mike King)
Subject: Re: Perl on standalone NT 4.0 server
Message-Id: <34275c3f.99085897@news.ozemail.com.au>
On Mon, 22 Sep 1997 09:36:08 -0700, "Myles Lawrence"
<myleslawrence@email.msn.com> wrote:
>I'm kind of stuck. I've most documentation, couple of books, etc. I'm
>running NT4.0 Server as a standalone at home without network and have
>installed perl and have checked the path and registry. When I click on a
>link to a perl script, the browser tries to open it instead of run it. I can
>run perl standalone from the perl5 directory but not from a web page. Any
>suggestions?
>Myles
Presumably you are using IIS. In order to run perl, you need to make
some small changes to the registry. The Perl5 for Win32 distribution
kit contains some information about what you need to do to tell it the
a .pl file is to be executed rather than just read and returned.
Very easy really (but aren't they all ?)
Mike (no spam please)
------------------------------
Date: 23 Sep 1997 04:44:44 GMT
From: pojo@gte.net.nospam (Eric)
Subject: Re: perl/win95/Long File Names
Message-Id: <607hfs$8ap$1@gte1.gte.net>
On Wed, 27 Aug 1997 12:45:34 -0400, "Brian P. Moffatt"
<bmoffatt@virtualhometour.com> wrote:
>I am using perl5 on my win95 machine and I need to "opendir" a LFN
>directory.
>Any suggestions.
>/program files/netscape/navigator/program/...................etc. you
>get the point.
>how do I get in there??
>Thanks in advance.
>Brian
>
Here's a little routine I wrote for reading directory trees. Works fine on my
win95 system, long filenames and all. Deals well with the UNIX style
forward-slash (/). Perl version info (Gurusamy Sarathy NT port, I believe):
---------------------------------------------------------------------------------------------
This is perl, version 5.004_02
Copyright 1987-1997, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
---------------------------------------------------------------------------------------------
Script itself. It's a bit hairy, 'cause it's recursive, and it also deletes
elements of an array while iterating over it, so be careful. I'm sure large
directory structures can suck a lot of memory.
Returns a list of filenames relative to the only parameter (base directory,
including drive letter if you so desire).
DOES NOT return directory names by themselves, only files with relative
directory info prepended (if any):
Returns:
test.txt
dave.txt
user.exe
foo/bar.txt
foo/banana.txt
But not:
test.txt
dave.txt
user.exe
foo/ <-- does not return directory references alone
foo/bar.txt
foo/banana.txt
---------------------------------------------------------------------------------------------
sub get_dir_struct
{
my (@list,$base_dir,$r);
$base_dir = $_[0]
$base_dir =~ s/(.*)\/$/$1/; # ONLY looks for trailing / to delete, NOT \
if (!(opendir DIR,$base_dir))
{return undef;}
@list = readdir(DIR);
closedir (DIR);
for ($r=0;$r <scalar(@list);$r++)
{
if ($list[$r] !~ /[\/\\]+/)
{$list[$r] = $base_dir ."/". $list[$r];}
if (-d $list[$r])
{
if ($list[$r] !~ /\.{1,2}$/)
{push @list, get_dir_struct($list[$r]);}
splice (@list,$r--,1);
}
}
return @list;
}
---------------------------------------------------------------------------------------------
------------------------------
Date: Tue, 23 Sep 1997 11:15:36 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Ret Value from Opened Pipe
Message-Id: <342788B8.73F4418C@absyss.fr>
Matthew Cravit wrote:
> If you read the man page for wait(2), you'll find the following about the
> return value of wait() (at least, on Solaris; YMMV on other OSs):
I've done the same sort of thing on Solaris, HP-UX and Linux (in C, not
Perl, but I don't see why that would matter). I don't know if it is a
carved-in-stone Unix standard, but it seems to be at least a defacto
standard.
> So, if you want to be really paranoid, you can check the lower 8
> bits of the return value to find the return code of the process, and
> you can also check the upper eight bits to make sure the process did
> not exit because of a signal or a core dump.
Actually, that's backwards, isn't it? Check the signal first and if it
is 0, then check the exit code.
- doug
------------------------------
Date: 23 Sep 1997 00:44:21 -0700
From: cubranic@cs.ubc.ca (Davor Cubranic)
Subject: setsockopt (solving 'address already in use' error)
Message-Id: <607s0l$nev@cascade.cs.ubc.ca>
I have a simple server script that accepts input from a socket from
multiple clients (remembering the filehandle of the accept()'ed socket
in an array, i.e., it does not close the connection immediately). It
does so until the user tells it from STDIN that there are no more
clients (it uses select() on STDIN and the socket) Then it does its
processing, goes in a loop, and sends the result to all the clients,
closing their sockets in turn, and finally closes the original socket
(the one that was used for bind() and listen()).
Now, I had a problem where on subsequent runs my bind() was failing with
error 'address already in use'. If I waited for ~5 minutes, the program
would work again. I assume the cause of this is that some close() somewhere
in kernel didn't really close a socket, which indeed left my address in use.
Unix Network Programming mentions this, saying that it happens if there
were still data to send on a socket, in which case the kernel usually waits
for a certain period of time before actually shutting it down.
First of all, I'm baffled what data were still there to be sent, as my
clients got everything the server sent them and vice versa. Am I
overlooking something here? If the program wasn't contacted by any
clients, i.e., there was nothing for it to write back, there was no error
on subsequent runs.
Second, after wasting a few hours on this, I decided to hack a quick
kludge and simply set the socket options to ignore 'address already in use'
problem. In the FMYTK docs, I saw the following incantation:
setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1)
However, this caused trouble when I tried to use in in Perl4 (I forgot to
mention that my script has to work on 4.036.), of course with &SOL_SOCKET
and &SO_REUSEADDR, to jibe with socket.ph file. I started getting errors
like 'using [gs]etsockopt on closed fd'. Finally, after browsing a little
bit more documentation, I tried:
setsockopt(S, &SOL_SOCKET, &SO_REUSEADDR, pack("l", 1))
which finally seemed to work.
The question is: a) why was I getting those bind() errors in the first
place, and b) why did I have to pack the value in perl4 and was able to
use plain scalar in perl5 (I wasn't able to find any mention in docs about
this one)?
Thanks,
Davor Cubranic
------------------------------
Date: Tue, 23 Sep 1997 07:05:45 GMT
From: s93glo@ida.csd.uu.se (Gvran Lvfstrvm)
Subject: Re: Uploading files larger than 50k from webpage IMPOSSIBLE?
Message-Id: <342768d7.698003095@news.ericsson.se>
On 19 Sep 1997 17:34:57 GMT, pi@complx.LF.net (Kurt Jaeger) wrote:
>In article <342228BA.AAA44D64@mail.student.uu.se>,
>Gvran Lvfstrvm <golo1517@mail.student.uu.se> wrote:
>>I am using perl 5.004 and have made a script that is supposed to handle
>>file uploads from webpages.
>>The script uses cgi-lib.pl 2.14 for stripping the form-data, and I use
>>the <INPUT TYPE=file> construction in Netscape within the form.
>>
>>Now, the script works really good if I upload files smaller than about
>>50k. Above that, the webserver reports 'Premature EOF' and 'Pipe Ended'.
>
>Set the following cgi-lib variable, default is 50K:
>
>$cgi_lib'maxdata = 131072; # maximum bytes to accept via POST - 2^17
So, if I for instance wanted be able to upload 1 mb of data, do I need
to recalculate the value according to the ' # maximum bytes to accept
via POST - 2^17'?
I have already set this variable from my first CGI by using
'cgi-lib::maxdata=1000000', and that didn't seem to work...
So, my basic stupid question is:
How can 131072 bytes amount to 50 kilobytes?
Thanks,
Gvran.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1062
**************************************