[16773] in Perl-Users-Digest
Perl-Users Digest, Issue: 4185 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 31 06:05:30 2000
Date: Thu, 31 Aug 2000 03:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <967716311-v9-i4185@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 31 Aug 2000 Volume: 9 Number: 4185
Today's topics:
Re: About reading the chinese file. <lincolnmarr@nospam.europem01.nt.com>
Re: Bulk add to a hash.. Thanks for the help! alphazerozero@my-deja.com
cgi displayed as text hobyah75@my-deja.com
Re: cgi displayed as text (Gwyn Judd)
Re: Extra ^M in text file <lubbers@jps.net>
Re: Extra ^M in text file (Martien Verbruggen)
Re: File handles with scalar value (Anno Siegel)
Re: File handles with scalar value <elephant@squirrelgroup.com>
Re: File handles with scalar value <elephant@squirrelgroup.com>
Re: ftp function call in perl change the file size. <calvin@pixelmetrix.com>
generate the html doc. <chaptera@hotmail.com>
Re: Getting the greedy RegEx, wanting the Lazy - help? <nickco3@yahoo.co.uk>
Re: Getting the greedy RegEx, wanting the Lazy - help? <iltzu@sci.invalid>
Re: help..I don't know what is this??? <philipg@atl.mediaone.net>
Re: hour difference between localtime and POSIX::mktime (Villy Kruse)
How get all parameters of cgi-form? <paul@pco.iis.nsk.su>
How to read a dir with recursive directories? <roco3d@pmail.net>
Re: How to read a dir with recursive directories? (Abigail)
Re: interchanging variables <bart.lateur@skynet.be>
Re: Just Cant Get The File Upload Thing <joe.usenet@sunstarsys.com>
Re: legal date <nickco3@yahoo.co.uk>
Re: Looking for help with list element numbering <root@vip.onlysupplies.com>
Modem communication (/dev/ttyS*) ambrosa@hsgerardo.org
modified (chunk-) pointer in perl5 on freebsd <jwolpert@slip.net>
Module, Code for paged search results? <fritz.heinrichmeyer@fernuni-hagen.de>
Re: Need Help with CGI <elephant@squirrelgroup.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 31 Aug 2000 10:06:15 +0200
From: "Lincoln Marr" <lincolnmarr@nospam.europem01.nt.com>
Subject: Re: About reading the chinese file.
Message-Id: <8ol3lg$qb7$1@qnsgh006.europe.nortel.com>
This may be completely wrong but don't you just have to change the encoding
on the browser to traditional chinese character set?? I don't think this is
a Perl question though....
"Tom" <chaptera@hotmail.com> wrote in message
news:39ADB2AC.BB9270A5@hotmail.com...
> Dear all,
>
> I wrote a perl program which is read a chinese character file, then
> redirect the
> output for the web page.
> But when on the web page, it will show the ÁÙ¤£«Hªº¸Ü,ºô¥D·|© code,
> Does anyone know how to solve this problems?
>
> 1.pl
> print header();
> ........
> open(INFILE, "$filenm") || err("Error on opening files: $!");
> while (<INFILE>)
> {
> print "$_\n";
> }
> close(INFILE);
> Thank you very much.
>
------------------------------
Date: Thu, 31 Aug 2000 08:22:30 GMT
From: alphazerozero@my-deja.com
Subject: Re: Bulk add to a hash.. Thanks for the help!
Message-Id: <8ol4jo$p2l$1@nnrp1.deja.com>
brian@smithrenaud.com (brian d foy) wrote:
> Perl has nothing to do with it. it's a human issue. the code
> will be as readable as the programmer wants it to be no matter
> what the language is.
Well Im not so sure about that. Some languages are more inclined
towards legibility
I mean the whole {} block structure, the then-less if, the postfix
conditional etc are more aimed at ease of notation not ease of
reading. The "teaching" languages usually avoid these structures to
sponsor legibility.
No doubt though, the careful selection of variable names and a bit of
time indenting and commenting is definately a worthy investment.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 31 Aug 2000 05:31:00 GMT
From: hobyah75@my-deja.com
Subject: cgi displayed as text
Message-Id: <8okqil$de3$1@nnrp1.deja.com>
I wrote a cgi script on my linux (redhat) server. It runs fine.
I transferred the script to a new linux (unsure of which version)
server, which I *only* have FTP access to.
Now, when I attempt to view the page, it prints the script to the
browser instead of executing it. From everything I have seen and learned
about servers, this implies to me that the server does not think it
should be executing the .cgi extension (and is therefore sending it as
text). I told this to the administrator, and they claimed my permissions
were set wrong. They set them for me, and still nothing.
The other thing I noted is that the file is in a user directory... so
the url looks something like:
http://www.somewhere.net/~stuff/cgi-bin/stuff/stuff.cgi
note that i put the cgi-bin directory there. What I am thinking is one
of the following:
A) There exists a cgi-bin outside of the user's directory where the
scripts need to be placed before the server will execute them.
B) The server is not set to execute cgi scripts. (They claim they are
executing their own, so I think this is wrong).
Anyhow, the fact that I am getting the script printed out to screen and
NOT a "Server-side error" message implies to me that the server is
messing up, NOT my script. What I am looking for is some facts I can
give to the administrator, or maybe even a general consensus that this
is NOT a script or permissions problem. (I don't want to start causing
problems with out 99% certainty) Either that, or let me know if it is my
problem!
Also note, this is all remote, I've never met the admin, he has
graciously donated free web space for these scripts, which are to be run
for a grade school, so it's not like I can go making demands.
Thank you kindly in advance for any replies.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 31 Aug 2000 06:41:35 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: cgi displayed as text
Message-Id: <slrn8qrvgs.6j7.tjla@thislove.dyndns.org>
I was shocked! How could hobyah75@my-deja.com <hobyah75@my-deja.com>
say such a terrible thing:
>I wrote a cgi script on my linux (redhat) server. It runs fine.
What happened when you posted this question to a newsgroup with "cgi" in
the title (such as comp.infosystems.www.authoring.cgi)?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Man invented language to satisfy his deep need to complain.
-Lily Tomlin
------------------------------
Date: Wed, 30 Aug 2000 22:44:05 -0700
From: "Peter Lubbers" <lubbers@jps.net>
Subject: Re: Extra ^M in text file
Message-Id: <Vgmr5.223$kI2.18378@nntp1.onemain.com>
I and transfer a lot of files back and forth between NT and Solaris, for
testing and kept running into that problem.Now I use Ultra Edit 7.0. UEdit
has a great feature of one button Dos to Unix and vice cersa built in, along
with a host of great editing features and a customizable colorscheme for
Perl.
Try a free trial and get hooked on it:
http://www.ultraedit.com/ (When you save a file with.pl/pm extension, you
will see the colors change and your code will be more readable)
Pete
Villy Kruse <vek@pharmnl.ohout.pharmapartners.nl> wrote in message
news:slrn8qq8s1.euj.vek@pharmnl.ohout.pharmapartners.nl...
> On Wed, 30 Aug 2000 12:42:01 GMT,
> nkhan75@hotmail.com <nkhan75@hotmail.com> wrote:
>
>
>
> >Hello,
> >
> >I am working with Perl/NT. Every time I create a text file from my
> >program, I find a ^M at the end of each line of the file.
> >
> >Does anyone know why this is happening?
> >
>
>
> You mean one ^M character in addition to the one that is supposed to
> be there?
>
>
>
> Villy
------------------------------
Date: Thu, 31 Aug 2000 05:59:06 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Extra ^M in text file
Message-Id: <slrn8qrt0o.2cp.mgjv@verbruggen.comdyn.com.au>
[Please, for future reference: Put your reply _after_ the suitably cut
down text you reply to. It's easier to read posts that way, because it
is more natural. Thank you]
\begin[totally]{offtopic}
On Wed, 30 Aug 2000 22:44:05 -0700,
Peter Lubbers <lubbers@jps.net> wrote:
> Villy Kruse <vek@pharmnl.ohout.pharmapartners.nl> wrote in message
> news:slrn8qq8s1.euj.vek@pharmnl.ohout.pharmapartners.nl...
> > On Wed, 30 Aug 2000 12:42:01 GMT,
> > nkhan75@hotmail.com <nkhan75@hotmail.com> wrote:
> > >
> > >I am working with Perl/NT. Every time I create a text file from my
> > >program, I find a ^M at the end of each line of the file.
> > >
> > >Does anyone know why this is happening?
> > >
> > You mean one ^M character in addition to the one that is supposed to
> > be there?
>
> I and transfer a lot of files back and forth between NT and Solaris, for
> testing and kept running into that problem.Now I use Ultra Edit 7.0. UEdit
> has a great feature of one button Dos to Unix and vice cersa built in, along
> with a host of great editing features and a customizable colorscheme for
> Perl.
FTP has this great feature called ascii file transfer. It will
translate the end-of-line sequence into something appropriate for the
platform the file is transferred to.
It probably was designed so that editors wouldn't have to do it, which
leaves the programmer free to pick any editor they like. Hell... they
can even use one that doesn't know about foreign platform line
endings.
\end{offtopic}
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: 31 Aug 2000 09:11:15 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: File handles with scalar value
Message-Id: <8ol7fj$ksb$1@lublin.zrz.tu-berlin.de>
Keywords: Grenoble, eternity, kinglet, volatile
Mark-Jason Dominus <mjd@plover.com> wrote in comp.lang.perl.misc:
>In article <8oippa$ii7$1@lublin.zrz.tu-berlin.de>,
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>>>they accept either a FILEHANDLE or a scalar containing the name of the
>>>FILEHANDLE
>>>
>>>so it's quite simple for a scalar to be both a string and a filehandle
>>
>>True, but that's not the case at hand. In a text context, $file appears
>>to contain the name of the opened file, not of the filehandle connected
>>with it. The real background is that $file is an object that overloads
>>some operations, as another poster explained.
>
>You are both right. The basic trick look like this:
>
> sub trick_filehandle {
> my $file_name = my $filehandle_name = shift;
> open $filehandle_name, "< $file_name" or die ...;
> return $filehandle_name;
> }
>
> my $fh = trick_filehandle('/tmp/foo');
> print "The value as a scalar: $fh\n";
> print "But I can read data from it also: ", scalar(<$fh>), "\n";
>
>and no overloading is necessary to make it work.
Uh... is that how it is done? In the open statement, Perl treats
$filehandle_name as a symref, so this isn't compatible with strict
'refs' and can lead to rather irregular filehandle names.
Anno
------------------------------
Date: Thu, 31 Aug 2000 09:17:05 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: File handles with scalar value
Message-Id: <MPG.1418c00ef97508bd989737@localhost>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote ..
>jason <elephant@squirrelgroup.com> wrote in comp.lang.perl.misc:
>>QarnoS <qarnos@ozemail.com.au> wrote ..
>>>I'm in the intermediate stages of learning Perl and have a question
>>>which is annoying me enough to matter ;-)
>>>
>>>When working with the CGI module, if the submitted form contains a file
>>>upload, the CGI::param method will return a scalar which doubles as a
>>>filename and a file handle.
>>>
>>>Ie. I can do this:
>>>$file = $cgi->param('uploadedfile');
>>>print "Contents of $file:";
>>>print <$file>;
>>>
>>>I was just wondering how the CGI module achieves this.
>>
>>this is a function of the <> operator (and the 'open', 'print' and
>>'close' functions .. and where it makes sense - all other Perl things
>>that deal with filehandles)
>>
>>they accept either a FILEHANDLE or a scalar containing the name of the
>>FILEHANDLE
>>
>>so it's quite simple for a scalar to be both a string and a filehandle
>
>True, but that's not the case at hand. In a text context, $file appears
>to contain the name of the opened file, not of the filehandle connected
>with it. The real background is that $file is an object that overloads
>some operations, as another poster explained.
ooh magic .. that'll teach me for not checking CGI.pm
I actually saw the other poster mention the overload thing and winced -
awaiting the thump of correction .. thanks for making it a nudge *8^)
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 31 Aug 2000 09:19:16 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: File handles with scalar value
Message-Id: <MPG.1418c08fd32f748c989738@localhost>
Mark-Jason Dominus <mjd@plover.com> wrote ..
>In article <8oippa$ii7$1@lublin.zrz.tu-berlin.de>,
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>>>they accept either a FILEHANDLE or a scalar containing the name of the
>>>FILEHANDLE
>>>
>>>so it's quite simple for a scalar to be both a string and a filehandle
>>
>>True, but that's not the case at hand. In a text context, $file appears
>>to contain the name of the opened file, not of the filehandle connected
>>with it. The real background is that $file is an object that overloads
>>some operations, as another poster explained.
>
>You are both right. The basic trick look like this:
>
> sub trick_filehandle {
> my $file_name = my $filehandle_name = shift;
> open $filehandle_name, "< $file_name" or die ...;
> return $filehandle_name;
> }
>
> my $fh = trick_filehandle('/tmp/foo');
> print "The value as a scalar: $fh\n";
> print "But I can read data from it also: ", scalar(<$fh>), "\n";
>
>and no overloading is necessary to make it work.
>
>CGI.pm actually does overload the stringizing operation on the
>filehandle, but it's only for a cosmetic reason. The filehandles
>CGI.pm uses have package names attached to them, and the stringize
>operation removes the package name.
>
>The overloading isn't necessary to make the trick work, however.
I'd like to pretend that was why I didn't think it was overloaded .. but
truth be told .. I was like 'perldoc overload' as soon as it was
mentioned .. ack - yet another rock .. thanks
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 31 Aug 2000 15:26:00 +0800
From: calvin <calvin@pixelmetrix.com>
Subject: Re: ftp function call in perl change the file size.
Message-Id: <39AE0888.42BDA2B4@pixelmetrix.com>
Yeah, it does work well, thank you.
Doug Perham wrote:
> calvin <calvin@pixelmetrix.com> writes:
>
> > Hi all,
> >
> > When I used the "ftp.pl" in my source code to ftp and get some target
> > file, I found the file size I got would be changed. What happened? And
> > How to fix the problem?
> >
> > Thank you.
> >
> > Rgds,
> > Calvin
>
> you probably sent a binary file in ascii mode
>
> try
>
> use strict;
> use Net::FTP;
>
> my $ftp= Net::FTP->new("some.host.name", Debug => 0);
> $ftp->login("anonymous",'me@here.there');
>
> # -- !!!!!!!!!!!!! --
> $ftp-binary;
>
> $ftp->get("that.file");
>
> $ftp->quit;
>
> --
> Doug Perham o{..}o
> dperham@wgate.com moo! (oo)___
> WorldGate Communications, Inc. (______)\
> / \ / \
------------------------------
Date: Thu, 31 Aug 2000 17:38:00 +0800
From: Tom <chaptera@hotmail.com>
Subject: generate the html doc.
Message-Id: <39AE2778.6842E1F7@hotmail.com>
Hi all,
I have a question about using perl.
I want to use perl generating the html file but it will have error.
The html page only show like this:
<script language=javascript>
function banner(msg,ctrlwidth) {
for (i=0;i
{msg=" "+msg}
............
}
..........
perl.program
=========
$js<<END
<script language=javascript>
function banner(msg,ctrlwidth) {
for (i=0;i<=ctrlwidth;i++)
{msg=" "+msg}
............
}
END
print header();
print $js;
..........
Thank you very much.
Tom.
------------------------------
Date: Thu, 31 Aug 2000 09:04:29 +0100
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: Getting the greedy RegEx, wanting the Lazy - help?
Message-Id: <39AE118D.59D22665@yahoo.co.uk>
ptomsic@my-deja.com wrote:
> In article <39AD5CAA.F09E538D@stomp.stomp.tokyo>,
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> >
> > Greatest trick, my fondest, is making one of your chats
> > eat all posts except mine. Everybody makes a post, only to
> > watch it be eaten and replaced by my last posting. *laughs*
> > That was a slick trick. However, not as impressive as when
> > I reformatted perl core at your server requiring a server
> > reset to clear. Such comical results, I'll tell you. Have
>
> My SERVER? Perl CORE? Care to elaborate?
I can shed some light here. Kira has an ongoing struggle with reality
that sometimes manifests as "there's only 2 people on Usenet", her and
some Other person that has multiple names it switches between to confuse
her. This Other person finds fault in her code with "hate" and "malice"
and especially "hate". So if you're critising her in anyway you must be
this Other, hence stream of garbage above. She's mostly harmless,
sometimes entertaining, but it is necessary to warn people about her from
time to time.
------------------------------
Date: 31 Aug 2000 09:09:37 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Getting the greedy RegEx, wanting the Lazy - help?
Message-Id: <967712825.24032@itz.pp.sci.fi>
In article <2Y%q5.10112$D7.437538@news-west.usenetserver.com>, Daniel Chetlin wrote:
>I'm fairly sure that what you specified for the 'begin stuff' and 'end stuff'
>markers falls into the category of a "valid" HTML comment in that it's not
>really RFC compliant but HTML::Parser will grok it anyways.
If you really must know, <!---FOO--> is a perfectly valid HTML
comment. <!----FOO-->, however, is not. Blame SGML.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla | "By promoting postconditions to
and its pseudonyms - | preconditions, algorithms become
do not feed the troll. | remarkably simple." -- Abigail
------------------------------
Date: Thu, 31 Aug 2000 04:28:43 GMT
From: "Philip Garrett" <philipg@atl.mediaone.net>
Subject: Re: help..I don't know what is this???
Message-Id: <%9lr5.3731$Oc.743297@typhoon.southeast.rr.com>
Hardy Merrill <hmerrill@my-deja.com> wrote in message
news:8ok0t7$gek$1@nnrp1.deja.com...
> In article <8ojv7h$eb2$1@nnrp1.deja.com>,
> eduardo_m@my-deja.com wrote:
[snip]
> > I know how works this, but I want to know what the "$@" means...Is
> > something like a way to know if an error has ocurred????....
>
> DBI threads belong on the Perl DBI mailing list at dbi-users@isc.org.
In the OP's defense, this was a Perl question, not a DBI question.
Philip
------------------------------
Date: Thu, 31 Aug 2000 07:58:57 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: hour difference between localtime and POSIX::mktime
Message-Id: <G05DC7.1rt@kithrup.com>
Submitted-by: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
On Wed, 30 Aug 2000 10:23:41 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>In article <slrn8qpgop.d2n.vek@pharmnl.ohout.pharmapartners.nl> on 30
>Aug 2000 08:17:46 GMT, Villy Kruse <vek@pharmnl.ohout.pharmapartners.nl>
>says...
>
>...
>
>> That raises the question, what is the codifed POSIX behaviour of tm_isdst
>> when used as input to mktime? I tested on two systems; one ignores
>> tm_isdst and the other don't when calling mktime.
>
>Then one of the implementations doesn't conform to the POSIX (C)
>Standard.
>
>> The default of 0 for the isdst argument seems not to be the most useful
>> choice; the value -1, I would think, would a better default. Thus, if
>> you don't make an explicit decission you will get the time zone flag
>> which will normally be in effect for the time you try to convert.
>
>Presumably the POSIX Standard for library functions is that of the C
>Standard, which says this in a footnote:
>
> Thus, a positive or zero value for tm_isdst causes the mktime function
> to presume initially that Daylight Saving Time, respectively, is or is
> not in effect for the specified time. A negative value for tm_isdst
> causes the mktime function to attemp to determine whether Daylight
> Saving Time is in effect for the specified time.
>
Referring to which standards document? This issue deserves something more
than a footnote somewhere.
Follow up to: comp.std.unix
Villy
[ Extra included text for the comp.std.unix readers just tuning in. Note
the followup -- mod ]
------------------------------
Date: Thu, 31 Aug 2000 15:30:57 +0600
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: How get all parameters of cgi-form?
Message-Id: <8ol57u$2979$1@news.itfs.nsk.su>
Hello,
It's strange but I could not find the way to do it. I need array of all
parameters of cgi form.
I tried $q->param, but it did not work.
I use 'post' method.
Thanks for help
Paul
------------------------------
Date: Thu, 31 Aug 2000 00:34:40 -0400
From: "Rodrigo Cortés" <roco3d@pmail.net>
Subject: How to read a dir with recursive directories?
Message-Id: <5Mlr5.8365$gi.115631@maule>
What is the faster way to do this and list the archives?
--
==============================
Rodrigo Cortés
Roco3D
ICQ:35921840
roco3d@pmail.net
http://roco3d.virtualave.net
==============================
------------------------------
Date: 31 Aug 2000 06:36:28 GMT
From: abigail@foad.org (Abigail)
Subject: Re: How to read a dir with recursive directories?
Message-Id: <slrn8qrv5q.8ac.abigail@alexandra.foad.org>
Rodrigo Cortés (roco3d@pmail.net) wrote on MMDLVII September MCMXCIII in
<URL:news:5Mlr5.8365$gi.115631@maule>:
{} What is the faster way to do this and list the archives?
Faster than what?
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Thu, 31 Aug 2000 08:03:20 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: interchanging variables
Message-Id: <3k3sqsk13615vo1fbdv5f0gfcm8stn3b61@4ax.com>
Ren Maddox wrote:
>Actually, I believe (and some testing and "perldoc perlop" seem to
>bear out) that there is no requirement for the strings to be of equal
>length.
The reason why it is necessary is because the bitwise xor will have the
length of the longest string of its arguments. In the end, all strings
will be padded out with null characters, to the length ofthe longest
string.
--
Bart.
------------------------------
Date: 31 Aug 2000 00:33:16 -0400
From: Joe Schaefer <joe.usenet@sunstarsys.com>
Subject: Re: Just Cant Get The File Upload Thing
Message-Id: <m3n1huxd6b.fsf@mumonkan.sunstarsys.com>
paul5544@my-deja.com writes:
><SNIP>
> $fileName =~ s!^.*(\\|\/)!!;
> open (OUTFILE, ">$basedir/$fileName");
></SNIP>
Generally speaking, it is a BAD idea to let clients
name files on your server. (See ZDNet hackme challenge
for a good reason why not.) Make up you own name, but
use an extension with the same mime type.
><SNIP>
> while ($bytesread = read($pFile1,$buffer,1024))
></SNIP>
It appears $pFile1 is just an ordinary string, and probably
NOT an open filehandle.
You need to use CGI's upload features to put an open
filehandle in $pFile1, not the name of the (remote?)
file on the client's hard drive. If the form's file
upload widget is called "file", something like the
following should work:
$q = new CGI;
$pFile1 = $q->upload('file');
perldoc CGI says this:
...
When the form is processed, you can retrieve the entered
filename by calling param():
$filename = $query->param('uploaded_file');
Different browsers will return slightly different things
for the name. Some browsers return the filename only.
Others return the full path to the file, using the path
conventions of the user's machine. Regardless, the name
returned is always the name of the file on the user's
machine, and is unrelated to the name of the temporary
file that CGI.pm creates during upload spooling (see
below).
The filename returned is also a file handle. You can read
the contents of the file using standard Perl file reading
calls:
...
However, there are problems with the dual nature of the
upload fields. If you use strict, then Perl will complain
when you try to use a string as a filehandle. You can get
around this by placing the file reading code in a block
containing the no strict pragma. More seriously, it is
possible for the remote user to type garbage into the
upload field, in which case what you get from param() is
not a filehandle at all, but a string.
To be safe, use the upload() function (new in version
2.47). When called with the name of an upload field,
upload() returns a filehandle, or undef if the parameter
is not a valid filehandle.
...
Best,
Joe S
------------------------------
Date: Thu, 31 Aug 2000 09:27:56 +0100
From: Nick Condon <nickco3@yahoo.co.uk>
Subject: Re: legal date
Message-Id: <39AE170C.D2B00384@yahoo.co.uk>
eastking@my-deja.com wrote:
> In article <slrn8qcjfh.27o.marcel@gandalf.local>,
> marcel@codewerk.com wrote:
> > On Fri, 25 Aug 2000 08:53:33 GMT, eastking@my-deja.com
> > <eastking@my-deja.com> wrote:
> >
> > >I want to get a legal day most close(forward) to the day encrypted by
> > >the three variable '19990931'. In this case it should be '19990930'.
> >
> > If you want the next _forward_ date, shouldn't it be '19991001'?
> >
> > Anyway, localtime and Time::Local's timelocal() do that for you:
>
> But , I can NOT find Time::Locale in CPAN
That's Time::Local, and you don't need CPAN this time you have it already.
------------------------------
Date: Wed, 30 Aug 2000 19:05:58 -0400
From: Jody Fedor <root@vip.onlysupplies.com>
Subject: Re: Looking for help with list element numbering
Message-Id: <39AD9356.5991DC3F@vip.onlysupplies.com>
"John W. Krahn" wrote:
> Jody Fedor wrote:
> <snip>
>
> > #!c:\perl -w
> >
>
> open INFILE, 'c:/perl/logs/transfer.log' or die "Can't read
> transfer.log: $!\n";
>
> > print "reading transfer1.log\n";
> >
>
> while ( <INFILE> ) {
> chomp;
> if ( m#.*] "GET /cgi-bin/serve.pl/\d+/(.*\.htm) .*# ) {
> $seen{ $1 }++ if length $1 < 30;
> }
> }
>
> close INFILE;
>
> foreach $uniq ( sort keys %seen ) {
> print "$uniq $seen{$uniq}\n";
> }
>
> HTH
>
> John
Very compact and to the point John, Thanks alot!
Jody
After looking at the $seen{$1}++ I finally figured out the key (or filename) was
being incremented by 1 for each match with that hash (key). Thanks again for the
code compaction!
------------------------------
Date: Thu, 31 Aug 2000 07:47:43 GMT
From: ambrosa@hsgerardo.org
Subject: Modem communication (/dev/ttyS*)
Message-Id: <8ol2is$n22$1@nnrp1.deja.com>
A very stupid question but ... I haven't made this before :-))
I want write a small perl application that use a modem to connect to
remote host, send some data and read (and save) the result.
The remote host don't matter me.
Linux redhat6.2 platform, perl 5.005-03
Which is the best way (using alarm to manage the timeout) to "speak"
with /dev/ttyS* ??
Using a open(FH,"+</dev/ttyS1") doesn't work properly obviously.
Using IPC Open2 ??
Thanks in advance
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 31 Aug 2000 08:17:37 GMT
From: Jake <jwolpert@slip.net>
Subject: modified (chunk-) pointer in perl5 on freebsd
Message-Id: <39AE1404.3E3A5242@slip.net>
perl, version 5.004_04 built for i386-freebsd(2.2.8)
------------------------------
perl5 in realloc(): warning: modified (chunk-) pointer.
perl5 in free(): warning: modified (chunk-) pointer.
perl5 in free(): warning: modified (chunk-) pointer.
perl5 in realloc(): warning: modified (page-) pointer.
------------------------------
If anyone recognizes these "chunk-" and "page-" ,
"are these messages generated by a BAD program or a BAD build
or BAD OS?"
------------------------------
Date: 31 Aug 2000 08:09:08 +0200
From: Heinrichmeyer <fritz.heinrichmeyer@fernuni-hagen.de>
Subject: Module, Code for paged search results?
Message-Id: <ufsnrm2c8r.fsf@jfh00.fernuni-hagen.de>
Is there a ready to use module to represent database search results as
pages (like in gdmsearch, altavista etc.)?
--
Fritz Heinrichmeyer mailto:fritz.heinrichmeyer@fernuni-hagen.de
FernUniversitaet Hagen, LG ES, 58084 Hagen (Germany)
tel:+49 2331/987-1166 fax:987-355 http://www-es.fernuni-hagen.de/~jfh
------------------------------
Date: Thu, 31 Aug 2000 09:12:05 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Need Help with CGI
Message-Id: <MPG.1418bededbc61386989736@localhost>
Alan J. Flavell <flavell@mail.cern.ch> wrote ..
>On 29 Aug 2000, Jonathan Stowe wrote:
>
>> >><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
>> >
>> > *plonk*
>>
>> I'm with you matey - I would even stick my neck out to suggest that the
>> doctype lies about the actual content of the document ....
> ^^^^^^^^^^^^
>
>Worse than that: the doctype is meaningless, because certain
>case-sensitive parts (OK, I'll be honest, I forget which parts, and
>it's OT anyway) that have to be in uppercase, aren't.
>
>If you utter something meaningless, can it be a lie? That spoof is, I
>guess, injected by A Certain Software Package in order to lend a
>spurious aroma of technical wizardry to the product. YMMV.
while we're this far OT I wanted to meta comment .. I really appreciate
the language in the above paragraph .. it's like a whimsical skip
through a dictionary of adjectives .. it paints with new paint the old
old adage "Bloody Bill"
--
jason -- elephant@squirrelgroup.com --
------------------------------
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 4185
**************************************