[12026] in Perl-Users-Digest
Perl-Users Digest, Issue: 5626 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 11 12:09:12 1999
Date: Tue, 11 May 99 09:00:23 -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, 11 May 1999 Volume: 8 Number: 5626
Today's topics:
Re: A short example for using WIN32::ODBC and EXCEL (Robert Watkins)
Bug in Perl 5.005_03 for win32 on NT machine ?? <axel@itb.biologie.hu-berlin.de>
Build Problem (MVansic967)
Can't Write to Files? <jerryr001<NO-SPAM>@yahoo.com>
Re: FAQ 9.10: How do I redirect to another page? <hartleh1@westat.com>
Re: FAQ 9.10: How do I redirect to another page? (Larry Rosler)
Re: FAQ 9.10: How do I redirect to another page? (Bart Lateur)
Re: FAQ 9.10: How do I redirect to another page? <flavell@mail.cern.ch>
Re: global var disappearing, reappearing (M.J.T. Guy)
Re: Help processing a file <jdf@pobox.com>
Re: How to convert an e-mail to HTML (Randal L. Schwartz)
How to get a password from a user? <ChrisT@satlink.com>
Re: How to get a password from a user? (Tad McClellan)
Re: how to setup cgi <kperrier@blkbox.com>
How to stop/kill a Perl app on Win32 <jalil@corp.home.net>
Re: Mac System calls (Henry Penninkilampi)
Re: Need a little looping help (Randal L. Schwartz)
Re: Need a little looping help (Bart Lateur)
Need Help with putting Hashes in a two-dimensional arra <martin.baur@mindpower.com>
Re: neverendless loop in regexp <jdf@pobox.com>
Re: neverendless loop in regexp <hvermeulen@nospam-correctnl.com>
newbie need help - Windows vs Linux <bloodstorm@rocketmail.com>
Re: perl command line args <sgutti@usa.net>
Re: print "Location: $filename\n\n"; (Randal L. Schwartz)
PWS and Perl <rusenet@bigfoot.com>
Re: Q: header for no-caching of files? (Randal L. Schwartz)
Re: Regular Expression Help <jdf@pobox.com>
Re: Searching a directory for certain HTML files. <jdf@pobox.com>
Re: Sorting is too slow for finding top N keys... - BEN <dfan@harmonixmusic.com>
Tie a database file <donny@impulsesoftware.com>
Re: why won't this cgi script work? <Care227@ibm.net>
Re: why won't this cgi script work? <aqumsieh@matrox.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 11 May 1999 13:50:20 GMT
From: r-watkins@worldnet.att.net (Robert Watkins)
Subject: Re: A short example for using WIN32::ODBC and EXCEL
Message-Id: <7h9cjm$k7n$1@bgtnsc03.worldnet.att.net>
In article <7h8nuf$if4$1@nnrp1.deja.com>, sebhenkel@my-dejanews.com wrote:
>
>can anybody give me a short example on how to perform a search for a
>word or value in an Excel-spreadsheet using the WIN32::ODBC module?
>I am able to connect to my ODBC source, but somehow I am at a loss on
>how to search in an excel spreadsheet for a value or a word. I have to
>admit, that I am a total beginner regarding the use of SQL and ODBC.
>
Sebastian --
I got my start using the very helpful examples at:
http://multiweb.lib.calpoly.edu/odbc/
I'm sure they will get you where you need to go.
-- Robert
---------------------------------------------------
Robert Watkins
r-watkinsNO@SPAMworldnet.att.net
---------------------------------------------------
"These Perls of thought in Persian Gulfs were bred,
Each softly lucent as a rounded moon;"
-- James Russell Lowell
In a Copy of Omar Khayyam
------------------------------
Date: Tue, 11 May 1999 17:37:26 +0200
From: a_kowald <axel@itb.biologie.hu-berlin.de>
Subject: Bug in Perl 5.005_03 for win32 on NT machine ??
Message-Id: <37384EB5.486AB2C5@itb.biologie.hu-berlin.de>
Hello everybody,
I just installed Perl 5.005_03 for win32 on my NT4 machine and when I
use "read()" to read a binary file perl only reads the first 511 bytes.
For instance: $tmp=read(FP,"file.bin",1000) results in $tmp being 511
Is this a bug, a feature or what am I doing wrong ?
Btw, the same perl script runs fine under unix.
Many thanks,
Axel
--
------------------------------------------------------------------------------------------
Dr. Axel Kowald Email:
a.kowald@itb.biologie.hu-berlin.de
Humboldt University Berlin Tel: +49 30 20939105
Innovationskolleg Theoretische Biologie Fax: +49 30 20938801
Invalidenstr. 43
10115 Berlin
Germany
-------------------------------------------------------------------------------------------
------------------------------
Date: 11 May 1999 14:22:04 GMT
From: mvansic967@aol.com (MVansic967)
Subject: Build Problem
Message-Id: <19990511102204.04899.00000920@ng-cg1.aol.com>
I am having a problem building Perl5.005_03 on my HP-UX 10.01 system. I get
the following message during the make test (actually ./perl harness):
/usr/lib/dld.sl: Unresolved symbol: _dbm_open (code) from /usr/lib/libdbm.1
dubious
Test returned status 0 (wstat 134, 0x86)
test program seems to have generated a core
Anyone know what I did wrong?
------------------------------
Date: Tue, 11 May 1999 11:33:37 -0400
From: "Jerry Raynor" <jerryr001<NO-SPAM>@yahoo.com>
Subject: Can't Write to Files?
Message-Id: <926436727.891.47@news.remarQ.com>
$path = "/home/user1/public_html/files/";
sub PrintEnter{
#submit customer info to text file
$file = "$path" . "customers.txt";
if (-e $file) { #if the file exists...
print "$file<BR>exists"; #checksum to see if it reaches
this if statement
open(DAT, ">>$file"); #open the file for appending
}
else {
print "$file<BR>does not exist"; #checksum to ensure it reaches this else
statement
open(OUTF,">$file"); #open the file for output
}
print OUTF "$username|$customer\n";
close(OUTF);
}
I continue to get the checksum for the else statement through the browser:
/home/user1/public_html/files/customers.txt
does not exist
It never creates the file and if I create the file myself and run it I get
the same thing files does not exist and yes it is pathed correctly, I went
as far as doing a pwd to get the current directory and cutting and pasteing
it into the script. I'm loosing my mind!!
------------------------------
Date: Tue, 11 May 1999 09:11:19 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: FAQ 9.10: How do I redirect to another page?
Message-Id: <37382C77.92F94951@westat.com>
I know this can be found elsewhere but since you are addressing the topic of
redirection, how 'bout adding a sentence about targeting another frame (since
this took me a while to figure out, even after reading references in the CGI
FAQ). Something like:
To target a particular frame in a frameset, include the "Window-target:" in the
header.
print "Location: http://www.domain.com/newpage\nWindow-target: <FrameName>\n\n";
It's a little thing but those of us who don't know much about headers will find
it useful.
Henry Hartley
Tom Christiansen wrote:
> How do I redirect to another page?
------------------------------
Date: Tue, 11 May 1999 07:41:58 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 9.10: How do I redirect to another page?
Message-Id: <MPG.11a1e19357918ca4989a2a@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7h954r$r6t$1@nnrp1.deja.com> on Tue, 11 May 1999 11:43:23
GMT, S Starre <sstarre@my-dejanews.com> says...
> This was a very helpful post, Thank-You for taking the time to put it
> up.
>
> In a recent post (or one of the FAQ's I can't recall which) you
> recomended strongly to use CGI.pm over other means of capturing POST
> data such as processing the CONTENT_LENGTH and all of that. As I already
> have dozens of CGI scripts that process POST data using CONTENT_LENGTH,
> and I wonder about the value in going back and rewriting them. They seem
> to be working fine, but are they timebombs? Should I mend my ways and
> using CGI.pm from here on out, or make restitution for my sins?
Though your query addresses TomC directly, I'll undertake to answer it.
(It happens we had a small dialogue about this, just last week -- 5
May.)
The specific issue is that most newcomers have cut-and-pasted the
following line of code from some unvetted source (book or 'script'):
read(STDIN, $buffer, $ENV{CONTENT_LENGTH});
Looks familiar, right?
Omitted from this code are:
1. Check that $ENV{REQUEST_METHOD} exists and that its value is 'POST'.
2. Check that $ENV{CONTENT_LENGTH} exists and that its value is a
positive integer.
3. Declaration of $buffer (for 'use strict;') and initialization to ""
(to suppress a '-w' warning on some perls).
4. Check that the read() actually returns $ENV{CONTENT_LENGTH} bytes.
I do all of these things, because paranoia in an inherently hostile
environment is a Good Thing. However, I wrote (in
<http://x24.deja.com/[ST_rn=ps]/getdoc.xp?AN=474391765>):
And my POST input reads have never failed. But that's no excuse not to
test the success of the 'read' (or 'sysread' :-) system call, just as we
insist on checking 'open'.
And Tom responded (in
<http://x24.deja.com/[ST_rn=ps]/getdoc.xp?AN=474391766>):
In comp.lang.perl.misc,
lr@hpl.hp.com (Larry Rosler) writes:
:And my POST input reads have never failed.
Mine have. Many many times. Usually from people
using odd browsers on primitive consumerist nonsystems.
I don't know why. Iwang was a bad one.
--tom
> PS: When I started writing CGI I don't think CGI.pm existed, so under
> the law I must be partially vindicated!
Neither did I. And I learned a lot and created my own small toolkit in
the process, so I don't need CGI.pm now. But I *would* recommend it to
those who don't want to climb that learning curve.
<SNIP> of unnecessary reposting of the FAQ, Jeopardy style.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 11 May 1999 15:12:57 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: FAQ 9.10: How do I redirect to another page?
Message-Id: <373c46c0.27073081@news.skynet.be>
Tom Christiansen wrote:
> How do I redirect to another page?
>
> Instead of sending back a `Content-Type' as the headers of your
> reply, send back a `Location:' header. Officially this should be a
> `URI:' header, so the CGI.pm module (available from CPAN) sends
> back both:
>
> Location: http://www.domain.com/newpage
> URI: http://www.domain.com/newpage
Strange. I would have thought people would consider this question as
off-topic for this newsgroup. And now it's even posted as a FAQ.
Bart.
------------------------------
Date: Tue, 11 May 1999 17:27:45 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: FAQ 9.10: How do I redirect to another page?
Message-Id: <Pine.HPP.3.95a.990511172226.21220J-100000@hpplus01.cern.ch>
On Tue, 11 May 1999, Bart Lateur wrote:
> Strange. I would have thought people would consider this question as
> off-topic for this newsgroup. And now it's even posted as a FAQ.
I followed-up to attempt some discussion along the same lines, and
trying to move the discussion to comp.infosystems.www.authoring.cgi.
But it seems that the automoderation for that group has suppressed the
copy that I intended to be posted here.
To avoid multi-posting, could I respectfully draw attention to the
followup in the CGI group? If I was talking nonsense then I'd
appreciate some reasoned discussion ;-)
all the best
------------------------------
Date: 11 May 1999 15:01:50 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: global var disappearing, reappearing
Message-Id: <7h9gou$i3f$1@pegasus.csx.cam.ac.uk>
Tom Christiansen <tchrist@mox.perl.com> wrote:
>
>There is no inconsistency. But perhaps you have some mistaken
>notion that lexical variable are shared amongst threads.
>
>They aren't.
There's no special relationship between lexicals and threads.
If a subroutine can be called from several threads, any external lexicals
referred to by the subroutine will be shared between the threads.
Mike Guy
------------------------------
Date: 11 May 1999 09:38:04 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: csartori@my-dejanews.com
Subject: Re: Help processing a file
Message-Id: <m3hfpj4thf.fsf@joshua.panix.com>
csartori@my-dejanews.com writes:
> $fhw = new FileHandle;
>
> if ($fhw->open("+> newterm.txt")) {
There are several problems with this code. There's no reason at all
to use the FileHandle module here. It bloats your code and adds no
functionality at all to plain filehandles.
That mode you're using is not sensible. It seems you just mean ">".
If you wanted to read from *and* write to the file, you'd use "+<".
But "+>" doesn't make any sense.
Finally, you do not report on error conditions, which is a big no-no
around here.
open( OUTFILE, '> newterm.txt' )
|| die "Can't create newterm.txt: $!\n";
> select($fhw); # Sets this handle as the standard output
Too fancy by half. Just
print OUTFILE "foo\n";
> print "$4 follows $1.\n";
^
that is not the apostrophe ' character
I don't know what it is!
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 11 May 1999 07:27:02 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How to convert an e-mail to HTML
Message-Id: <m11zgnof61.fsf@halfdome.holdit.com>
>>>>> "Elias" == Elias Skalkidis <eliassk@homemail.com> writes:
Elias> I want to convert an incoming e-mail in UNIX to an HTML file.
use HTML::Entities;
print "<pre>\n", encode_entities($incoming_mail), "\n</pre>\n";
There. Is that what you wanted? If not, you need to specify a bit
better. :)
Elias> I have tried hypermail but I can't get it to work.
Admittedly, hypermail is a bit underdocumented, but if you can't get
*that* to work, what confidence do we have that you'll get a solution
of *ours* to work?
Just call me "puzzled" here.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 5 May 1999 15:09:38 -0300
From: "Christian Tagtachian" <ChrisT@satlink.com>
Subject: How to get a password from a user?
Message-Id: <7gq0po$o7r$1@ul3.satlink.com>
Hi,
Can anyone give me a hand showing me how to get a password from a user?
That means, I need to turn echo off while he writes it, and then turning it
back on. If everyone knows a better way to handle it also let me know. I've
been trying for hours to turn the echo off without any sucess
Thanks.
PS: Could you please send me an email? I don't usually read this group.
------------------------------
Date: Tue, 11 May 1999 06:20:43 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to get a password from a user?
Message-Id: <r909h7.k1f.ln@magna.metronet.com>
Christian Tagtachian (ChrisT@satlink.com) wrote:
: Can anyone give me a hand showing me how to get a password from a user?
The Frequently Asked Questions, already installed on your hard disk,
can give you a hand.
But you have to look at them to get help from them.
perl -ne 'print "$ARGV: $_" if /^=.*password/' perlfaq*.pod
perlfaq8.pod: =head2 How do I ask the user for a password?
perlfaq8.pod: =head2 How do I decode encrypted password files?
perlfaq8.pod: =head2 How do I modify the shadow password file on a Unix system?
perlfaq9.pod: =head2 How do I put a password on my web pages?
: PS: Could you please send me an email? I don't usually read this group.
Ask it here, get the answer here.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 11 May 1999 10:49:33 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: how to setup cgi
Message-Id: <ysilnev4nea.fsf@blkbox.com>
"Mark Twells" <mark@RemoveThismtwells.demonRemove.co.uk> writes:
>
> > comp.infosystems.www.authoring.cgi
> > comp.infosystems.www.servers.*
>
> Some of us don't get those ngs...and are left with the same problem.
>
> How do we configure perl to work with MS PWS - I've put entries in the
> registry which "look" correct, but the server hangs on these.
> Could some kind soul please EMAIL me (since it's not a perl question we
> MUSTn't clutter up this NG) the correct entries for the registry?
Humm, you cannot go to www.dejanews.com and see these newsgroups? They
YOU really do have a problem.
Kent
------------------------------
Date: Tue, 11 May 1999 15:10:17 GMT
From: "Jalil Feghhi" <jalil@corp.home.net>
Subject: How to stop/kill a Perl app on Win32
Message-Id: <926435416.959029@zeppelin.svr.home.net>
1. Is there anyway to stop or kill a Perl app on Win32? Anything like
signals on Unix?
2. Is there any timer functionality in Perl on Win32?
Thanks,
-Jalil
------------------------------
Date: Wed, 12 May 1999 00:30:29 +0930
From: spamfree@metropolis.net.au (Henry Penninkilampi)
Subject: Re: Mac System calls
Message-Id: <spamfree-1205990030290001@d4.metropolis.net.au>
In article <373788F1.7078FCBE@umich.edu>, mcshultz@umich.edu wrote:
>are there such things as system calls in MacPerl?
>obviously mac isn't command line oriented, so where could i find out
>what these calls are?
>
>thanks,
>matt
If you've got MacPerl installed, look under the Help menu - 'Macintosh
Toolbox Modules' probably contains the information you need.
Henry.
------------------------------
Date: 11 May 1999 07:22:08 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Need a little looping help
Message-Id: <m1btfrofe7.fsf@halfdome.holdit.com>
>>>>> "todd" == todd b smith <todd_b_smith@my-dejanews.com> writes:
todd> I don't want to write 20 nested for's.
"20 nested for's" almost certainly means you're trying to use
a screwdriver as a hammer. Please (as other people already asked)
describe your PROBLEM so we can help you CODE it properly.
I can bet the rent money that there won't be a single expert here that
will agree "20 nested fors... yup, that's the only way to do this
one".
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Tue, 11 May 1999 14:54:13 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Need a little looping help
Message-Id: <373a4449.26441334@news.skynet.be>
Randal L. Schwartz wrote:
>"20 nested for's" almost certainly means you're trying to use
>a screwdriver as a hammer.
>
>I can bet the rent money that there won't be a single expert here that
>will agree "20 nested fors... yup, that's the only way to do this
>one".
How about.... processing a 20-dimensional array?
Bart.
------------------------------
Date: Tue, 11 May 1999 15:26:18 +0200
From: Martin Baur <martin.baur@mindpower.com>
Subject: Need Help with putting Hashes in a two-dimensional array
Message-Id: <37382FFA.B29D15F6@mindpower.com>
Hi
Can anybody please help me? Please consider this
---
$v1 =
"&BASKETZEILE1=BZ_STATUS=0&&BZ_AR_INTNUM=1&&BZ_AR_PREIS=46100&&BZ_MENGE=100&&BZ_RABATT=00&&BZ_RABATTBETRAG=00&&BZ_TOTAL=46100"
."&BASKETZEILE2=BZ_STATUS=0&&BZ_AR_INTNUM=3&&BZ_AR_PREIS=11570000&&BZ_MENGE=200&&BZ_RABATT=00&&BZ_RABATTBETRAG=00&&BZ_TOTAL=23140000"
---
I'd llike to split that into a twodimensional array. Each cell should be
a hash. I tried the following (which is not even part of the solution)
---
@basket_rows = split (/&BASKETZEILE/, $v1);
for ($i=0; $i <= $#basket_rows; $i++) {
($basket_rows[$i]) = split (/&&/, $basket_rows[$i]);
}
---
This does not work. I want to access the data with two methods somehow
like this:
---
$v1 = $basket_rows[1]{'BZ_STATUS'}; # only the value of this key
$v2 = $basket_rows[1][2]; # the entire key=value pair
---
Please, can anybody MAILl me the correct splitting code and the correct
referencing for accessing or printing the values of the name=value
paris?
Many thanky in advance.
Martin Baur
------------------------------
Date: 11 May 1999 09:42:58 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: Henry <hvermeulen@correctnl.com>
Subject: Re: neverendless loop in regexp
Message-Id: <m3emkn4t99.fsf@joshua.panix.com>
Henry <hvermeulen@correctnl.com> writes:
> while ( /<!--start-->(.*?)<!--sov-->/sm ) {
You're missing the g modifier.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Tue, 11 May 1999 14:55:45 +0200
From: Henry <hvermeulen@nospam-correctnl.com>
Subject: Re: neverendless loop in regexp
Message-Id: <373828D0.4E799CDD@nospam-correctnl.com>
print "$_\n"; is going to be print OUT "$_\n";
I,ve used it this way so i can see directly what's happening instead of
opening the file to see what's done.
But the code is changed, i made this out of it.
And it works!
Thanx.
undef $/;
open OV, $ov or die "Cannot open $OV for read :$!";
while (<OV>) {
while ( /<!--start-->(.*?)<!--sov-->/sg ) {
open OUT1, ">$out1" or die "Cannot open $out1 for
write. :$!\n";
last if ($1 eq "<!--stop-->");
print OUT1 "$1\n";
close OUT1;
}
}
It was actually the /sg instead of /sm that did it...
Henry Vermeulen
Tad McClellan wrote:
> Why do you open a filehandle and then never use it?
>
> : while ($1 ne "<!--stop-->") {
>
> You never change the loop condition, so of course it can never
> become false, so the loop can never exit.
>
> Maybe you want if() instead of while() ?
>
> : print "$1\n"; }
> : close OUT1;
>
> :
------------------------------
Date: Wed, 12 May 1999 01:34:56 +1000
From: "IceLava)" <bloodstorm@rocketmail.com>
Subject: newbie need help - Windows vs Linux
Message-Id: <7h9ibp$b5u$1@dove.qut.edu.au>
I recently download the latest ActivePerl & am running it wif Apache in
Win98. it seems to work juz like in Linux except for 1 thing i discovered -
using the system command 'date' will cause General failure for device
LP!!!, watever that is..... has anybody experienced such a prob in Windows?
i'm new to Perl & Apache, & I can't seem to find any helpful info in the
docs that can rectify this prob.
pls email icelava@hotmail.com , i dun get to access newsgrp tt often.
thanx.
------------------------------
Date: Tue, 11 May 1999 14:35:23 GMT
From: "gwinsock" <sgutti@usa.net>
Subject: Re: perl command line args
Message-Id: <LeXZ2.1832$xa.20053@c01read02-admin.service.talkway.com>
Thanks Tad & Bob...thanks for your help.
sri
--
Posted via Talkway - http://www.talkway.com
Exchange ideas on practically anything (tm).
------------------------------
Date: 11 May 1999 07:29:48 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: print "Location: $filename\n\n";
Message-Id: <m1wvyfn0gz.fsf@halfdome.holdit.com>
>>>>> "W" == W Barksdale <wb_1999@yahoo.com> writes:
[some stuff that really belonged in CIWAC, but ignoring that...]
W> I am using 'print "Location: $filename\n\n";' in a perl script to
W> download a file.
There's your first mistake. There's nothing inherent in a URL that
says "download me" versus "try to interpret me". Nada. Zilch.
So, you'll need to provide a link, and ask the user to "download this
link". And of course, a stupid user is free to click on it instead,
and get the same results you describe.
Welcome to the web. URLs were made for viewing, not saving.
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Tue, 11 May 1999 16:42:15 +0200
From: "R!k" <rusenet@bigfoot.com>
Subject: PWS and Perl
Message-Id: <7h9f1n$fo6$1@enterprise.cistron.nl>
How can I use Perl scripts with Personal Web Server?
Rik
------------------------------
Date: 11 May 1999 07:19:22 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Q: header for no-caching of files?
Message-Id: <m1g153ofit.fsf@halfdome.holdit.com>
>>>>> "TheEadsNet" == TheEadsNet <theeadsnet@aol.com> writes:
TheEadsNet> Does anyone know what the header is to prevent browser caching of files
TheEadsNet> "print"ed by Perl?
There's nothing that can *prevent* it. Force doesn't work
on the web.
However, if you set an expires time of now (or earlier), *most* caches
know that it's not a file to keep around.
This question has nothing to do with Perl, and probably
would have been better answered in a group specifically about CGI,
as in comp.infosystems.www.authoring.cgi.
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 11 May 1999 09:13:34 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: "Gabe" <grichard@uci.edu>
Subject: Re: Regular Expression Help
Message-Id: <m3n1zb4um9.fsf@joshua.panix.com>
"Gabe" <grichard@uci.edu> writes:
> if ($type =~ /"(.+)"/) { &phrasesearch}
>#Will this match anything between two quotes and assign it to $1?
Well, yes... but it won't stop matching at the second quote it sees.
So if the string you're searching looks like
"foo" is a more popular metasyntactic variable than "smurf"
Then $1 will contain
foo" is a more popular metasyntactic variable than "smurf
The solutions are to use a negated character class (preferred) or to
use non-greedy matching (much backtracking, subtly different meaning)
/"([^"]+)/ # negated character class
/"(.+?)"/ # non-greedy
> elsif ($type =~ /\w+/sor) { &orsearch}
># Will this match any word that has whitespace and an "or" after it?
No, that's a syntax error. Also, it depends on what you mean by
"word".
/\w+\s+or\b/ # is one possible interpretation
> elsif ($type =~ /\w+/sand) { &andsearch}
>#Will this match any word that has whitespace and an "and" after it?
Same syntax error. That second / ends the regex, leaving the valid
regex modifier s and three weird ones, a, n, and d.
You need to read:
Learning Perl (The "LLama" book)
perlre
perlop
And for "advanced" study:
Mastering Regular Expressions (The "Hip Owls" book)
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 11 May 1999 09:17:04 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: "Donny Simonton" <donsimon@bellsouth.net>
Subject: Re: Searching a directory for certain HTML files.
Message-Id: <m3k8uf4ugf.fsf@joshua.panix.com>
"Donny Simonton" <donsimon@bellsouth.net> writes:
> I'm trying to search a directory for only certain HTML files with
> the name Image in them. So for example I want to list Image1.html,
> but not index.html.
You need to run to the bookstore and fetch yourself a copy of the
llama book, _Learning Perl_, published by O'Reilly. A couple of days
of study, and you'll wonder how you could possibly missed the answer,
staring at you as it is from the very code you posted.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 11 May 1999 10:18:16 -0400
From: Dan Schmidt <dfan@harmonixmusic.com>
Subject: Re: Sorting is too slow for finding top N keys... - BENCH
Message-Id: <wkr9ony9jr.fsf@turangalila.harmonixmusic.com>
lr@hpl.hp.com (Larry Rosler) writes:
| I haven't found a sort-extremes module under CPAN Sort::..., and
| neither Knuth Vol. 3 nor Sedgewick seems to have an algorithm. I
| will soon submit this to the Perl Function Repository, and perhaps
| make it into a module as a training exercise.
The problem is discussed in Knuth, though he doesn't present an
algorithm that you can cut and paste (not that a MIX implementation
would do us much good anyway).
5.2.2 Exercise 31 can be extended to find the top n elements of an
array (you do a quicksort but ignore everything on the side you're not
interested in; this sounds like Marko's quickselect).
5.3.3 discusses selection in general, and exercise 17 is a
generalization of the problem you describe (selecting both the k
largest and the l smallest elements).
--
Dan Schmidt -> dfan@harmonixmusic.com, dfan@alum.mit.edu
Honest Bob & the http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/
------------------------------
Date: Tue, 11 May 1999 15:07:45 GMT
From: Donny Widjaja <donny@impulsesoftware.com>
Subject: Tie a database file
Message-Id: <373848D9.9D39FFC4@impulsesoftware.com>
Hi,
I am new with MLDBM and database in Perl.
I wrote a simple database program in Perl using MLDBM from CPAN, and it
works. When I try to integrate my program into a CGI script, it does
not work. I have problem "Tie"-ing the database file. I believe I
don't have permission to tie the file as nobody.
What is the differences between open and tie? I can use open in CGI
scripts but I can't use tie in CGI scripts.
Thanks for your help.
------------------------------
Date: Tue, 11 May 1999 11:07:25 -0400
From: Drew Simonis <Care227@ibm.net>
Subject: Re: why won't this cgi script work?
Message-Id: <373847AD.D0F22DA0@ibm.net>
What I am meaning is this:
If you are doing this from a web page, you generally aren't going to use
alot of file handles like that, IMHO. Most of my forms gather user info
and parm's and then pass them into a script. If I am opening a file
handle, it is usually to write that info into a file or a named pipe
(sendmail, usually). I do occasionally read from a file, but I have
never
read only one line (I have read a line at a time, or searched for one
line, but the sample does not accomplish either).
Long stroy short, I am not saying it is improper or won't work, I was
just asking why he was doing it.
-Drew
S Starre wrote:
>
> In article <37375256.148077@news.skynet.be>,
> bart.lateur@skynet.be (Bart Lateur) wrote:
> > Drew Simonis wrote:
> >
> > >And, while I'm here, why are you reading a file into a scalar?
> >
> > Surely, the file contains just a number...
> >
> > Bart.
> >
>
> What other means of reading the file did you have in mind?
> -S
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
------------------------------
Date: Tue, 11 May 1999 10:38:04 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: why won't this cgi script work?
Message-Id: <x3y90avpt83.fsf@tigre.matrox.com>
Jonathan Stowe <gellyfish@gellyfish.com> writes:
> $count = <COUNT>;
>
> There is nothing wrong with that - it reads one line of the file into
> the scalar $count - if all the file contains is a single number then
> there is no reason to do anything else.
Maybe perhaps he needs a chomp() there.
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5626
**************************************