[18712] in Perl-Users-Digest
Perl-Users Digest, Issue: 880 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 12 00:06:05 2001
Date: Fri, 11 May 2001 21: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: <989640311-v10-i880@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 11 May 2001 Volume: 10 Number: 880
Today's topics:
Re: Re: Proposed new pragma: caution. 194.203.215.187 [demerphq@hotmail.com]
Re: Re: Proposed new pragma: caution. 194.203.215.187 [demerphq@hotmail.com]
Re: 1 billion seconds bug <ilya@math.ohio-state.edu>
Re: 1 billion seconds bug (Martien Verbruggen)
AutoSplit gets line numbers wrong?? <psmith@baynetworks.com>
Re: Bad File Number? <mikecook@cigarpool.com>
Re: basic TRUE / FALSE (Martien Verbruggen)
Re: can Perl do multiplexed output? <dontuspamme@nospammers.com>
Re: can Perl do multiplexed output? (Malcolm Dew-Jones)
Re: Converting a tab-delimited file? (Martien Verbruggen)
Re: Converting a tab-delimited file? <skilchen@swissonline.ch>
DBI weirdness... <xris@dont.send.spam>
DQ: Perl script vs perl.cgi <rick@rickfrazier.com>
Forcing default filename <mdudley@execonn.com>
Forcing default filename <mdudley@execonn.com>
Forcing default filename <mdudley@execonn.com>
Forcing default filename <mdudley@execonn.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 May 2001 23:04:23 GMT
From: 194.203.215.187 [demerphq@hotmail.com]
Subject: Re: Re: Proposed new pragma: caution.
Message-Id: <9dhr5n32sld@news1.newsguy.com>
> On 11 May 2001 11:43:26 GMT, 194.203.215.187 [demerphq@hotmail.com]
> If you're joking - haha. If you're not - no comment.
No joke. Whats the prob Bernard?
> Cheers,
> Bernard
==================================
Poster's IP address: 194.203.215.187
Posted via http://nodevice.com
Linux Programmer's Site
------------------------------
Date: 11 May 2001 23:04:22 GMT
From: 194.203.215.187 [demerphq@hotmail.com]
Subject: Re: Re: Proposed new pragma: caution.
Message-Id: <9dhr5m22sld@news1.newsguy.com>
> > Any thoughts are welcome...
>
> Superfluous.
>
> Anno
Which? Your thoughts or the pragma?
Perhaps you might deign to expand on your reply?
Yves
==================================
Poster's IP address: 194.203.215.187
Posted via http://nodevice.com
Linux Programmer's Site
------------------------------
Date: 11 May 2001 22:55:25 GMT
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: 1 billion seconds bug
Message-Id: <9dhqkt$qik$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Bart Lateur
<bart.lateur@skynet.be>], who wrote in article <0qioft0hkr2118mtgofaed8s9jgrnav30q@4ax.com>:
> >> But the OP said that *every* computer in the world would soon switch to
> >> a time() of 1 billion, all a the same time. Clearly, this can't be true.
> >
> >IMO, *this* point is also moot. Obviously, doorstop-computers won't.
> >So what? "Working" computers will, for an appropriate value of "working".
>
> So a Mac isn't a working computer? Not even a working Mac?
A lot of people would agree with this... But this is again moot: Macs
are *already* over 1Gsec.
Ilya
------------------------------
Date: Sat, 12 May 2001 09:13:20 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: 1 billion seconds bug
Message-Id: <slrn9fosgg.v5e.mgjv@martien.heliotrope.home>
On Thu, 10 May 2001 12:26:17 +0200,
Philip Newton <pne-news-20010510@newton.digitalspace.net> wrote:
> On Thu, 10 May 2001 00:14:40 -0000, cberry@cinenet.net (Craig Berry)
> wrote:
>
>> Start your code reviews now -- avoid the
>> last-second rush. :-)
>
> And while you're at it, you might as well start thinking about what to
> do when the year 2038 rolls around. Good to get a head start. (And no,
> just recompiling things with time_t being a 64 bit integer won't help
> if, for example, you have a binary protocol that specifies exactly
> four bytes for the time.)
We are planning for a full software review regarding that problem in
September and October 2037. We're afraid that if we do it right now,
that we might be spending time unnecessarily on one or two pieces of
software that might not be around anymore then.
The project and action plans will be submitted next week.
Martien
--
Martien Verbruggen |
Interactive Media Division | life ain't fair, but the root
Commercial Dynamics Pty. Ltd. | password helps. -- BOFH
NSW, Australia |
------------------------------
Date: 11 May 2001 23:36:30 -0400
From: "Paul D. Smith" <psmith@baynetworks.com>
Subject: AutoSplit gets line numbers wrong??
Message-Id: <p5lmo3w85d.fsf@lemming.engeast.baynetworks.com>
[[ I'm using Perl 5.6.0 on Linux and Solaris ]]
Is this a 5.6.0 bug? I can't believe no one has noticed this... so
maybe it's intended behavior? I've checked Camel, perlmod, perlmodlib,
perlfaq, Google, Deja, etc. and of course the AutoSplit and AutoLoader
man pages, and couldn't find this mentioned anywhere.
If I have an AutoLoader module with comments preceding a sub, then
AutoSplit gets the line numbers wrong in the .al file:
$ cat Foo.pm
package Foo;
use AutoLoader;
__END__
# Line 7: This is a very nice function
# Line 8: And here are some nice comments
sub foo {
return 0;
}
1;
$ cat Makefile.PL
use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => 'Foo',
'DISTNAME' => 'Foo',
);
$ perl Makefile.PL
Writing Makefile for Foo
$ make
mkdir blib
mkdir blib/lib
mkdir blib/arch
mkdir blib/arch/auto
mkdir blib/arch/auto/Foo
mkdir blib/lib/auto
mkdir blib/lib/auto/Foo
cp Foo.pm blib/lib/Foo.pm
AutoSplitting blib/lib/Foo.pm (blib/lib/auto/Foo)
Now, I look at the foo.al file:
$ cat blib/lib/auto/Foo/foo.al
# NOTE: Derived from blib/lib/Foo.pm.
# Changes made here will be lost when autosplit again.
# See AutoSplit.pm.
package Foo;
#line 10 "blib/lib/Foo.pm (autosplit into blib/lib/auto/Foo/foo.al)"
# Line 7: This is a very nice function
# Line 8: And here are some nice comments
sub foo {
return 0;
}
1;
1;
# end of Foo::foo
This is wrong! The #line directive says 10, which is the first line of
the sub, but it comes at line 7! This means that, in the debugger,
error messages, etc. the line numbers are all off by exactly the number
of lines as you have lines of comment before the sub.
For example, if I had an error on the "return" line here Perl would say
it was on line 14, instead of line 11.
That's darn confusing :).
Comments?
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@baynetworks.com> HASMAT--HA Software Methods & Tools
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.
------------------------------
Date: Fri, 11 May 2001 17:58:30 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: Bad File Number?
Message-Id: <cY%K6.1958$B42.340133@news.uswest.net>
D'oh!
Thanks so much! I can't believe I did that (& didn't catch it =)
Michael
--
== CigarPool ==
http://www.cigarpool.com
"Mark Jason Dominus" <mjd@plover.com> wrote in message
news:3afa3a6f.3d6b$221@news.op.net...
>
> In article <1ZnK6.2804$VX.392183@news.uswest.net>,
> Michael Cook <mikecook@cigarpool.com> wrote:
> >Hello,
> > I am getting this error when I try to run a CGI Perl script from the
> >command line. I am running Perl 5.6.1 on an Ultra 5, Solaris 8. Any
ideas?
>
> "file number" actually means "filehandle".
>
> The problem here is that your OS will not allow you to get an
> exclusive lock on a file that you have opened only for reading. (It's
> supid, but that's the way it goes.) Try
>
> open (MESSAGES, "+< board/$db") or die("Unable to open board/$db:
$!");
>
> instead.
>
> --
> @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub
p{
>
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^or
d
> ($p{$_})&6];$p{$_}=/
^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
> close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep
rand(2)if/\S/;print
------------------------------
Date: Sat, 12 May 2001 11:30:36 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: basic TRUE / FALSE
Message-Id: <slrn9fp4hs.v5e.mgjv@martien.heliotrope.home>
On Thu, 10 May 2001 20:04:31 +0200,
Rudolf Polzer <eins@durchnull.de> wrote:
> Todd Smith <todd@designsouth.net> wrote:
>> >
>> > my $showvar = TRUE;
>> >
>> > I can't find anything in the FAQs or docs about use of these things. Can
>> I
>> > not use them this way?
>> >
>>
>>
>> no, use 0 or 1
>
> and if he really wants to use TRUE and FALSE:
>
> use constant TRUE => 1;
> use constant FALSE => 0;
As long as it's only used for assignment. Perl has many different
possible values that are true and many that are false. Comparisons
against above constant are doomed to fail unexpectedly.
my $foo = "";
$foo is false from Perl's perspective, but not from the perspective of
the constants. Besides that, $foo is meant to be a string, and the
constant FALSE is an integer. Which comparison parameter are you going
to use?
And what about
my $foo = "0 but true";
suddenly, the true value of $foo compares numerically equal to FALSE. Is
that what you want?
Do NOT get into the habit of using TRUE and FALSE as if they're really
the magical values they should be. Learn what constitutes a true and
false value in Perl, and use that.
Martien
--
Martien Verbruggen |
Interactive Media Division | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Fri, 11 May 2001 15:40:26 -0700
From: "kalasend at YAHOO dot COM" <dontuspamme@nospammers.com>
Subject: Re: can Perl do multiplexed output?
Message-Id: <YQZK6.30$DB3.5955@chrome-fe.eng.netapp.com>
I know tee, but....it is a CGI program and the Web users don't know tee...
In other words, I want the script to write down its output somewhere on the
disk whenever it is invoked.
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:3afc5d0a@news.microsoft.com...
> "kalasend at YAHOO dot COM" <dontuspamme@nospammers.com> wrote in message
> news:6SYK6.29$DB3.5880@chrome-fe.eng.netapp.com...
> > I need to write a program that outputs to both STDOUT and a disk
file.
> > Is there anyway I can do this without calling "print" twice?
>
> You could just use "tee" to duplicate the output of any program into a
file.
>
> myprogram | tee mydiskfile
>
> jue
>
>
------------------------------
Date: 11 May 2001 16:17:21 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: can Perl do multiplexed output?
Message-Id: <3afc7301@news.victoria.tc.ca>
kalasend at YAHOO dot COM (dontuspamme@nospammers.com) wrote:
: Hi,
: I need to write a program that outputs to both STDOUT and a disk file.
: Is there anyway I can do this without calling "print" twice?
perldoc perltie
If all you use are "print"s then the only functions you need are the
initial tie function and the PRINT function, so it's very easy to get
started.
I don't know off hand how you print to stdout after you tie it. I
suspect you need to DUP it first or something. Or modify your prints to
use some other handle
print MY_STDOUT ...
--
Want to access the command line of your CGI account? Need to debug your
installed CGI scripts? Transfer and edit files right from your browser?
What you need is "ispy.cgi" - visit http://nisoftware.com/ispy.cgi
------------------------------
Date: Sat, 12 May 2001 09:46:34 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Converting a tab-delimited file?
Message-Id: <slrn9foueq.v5e.mgjv@martien.heliotrope.home>
On 10 May 2001 12:50:59 -0500,
Ren Maddox <ren@tivoli.com> wrote:
> On Thu, 10 May 2001, amnuts@talker.com wrote:
>
>> In article <d4alft80s81kitf52gpat9l7h6oott7m0j@4ax.com>,
>> bart.lateur@skynet.be says...
>>
>>> So, my advice is to look up the Text::CSV, or better yet, the
>>> Text::CSV_XS module. That'll help in getting the records read in
>>> properly.
>>
>> Great! I'll have a look into that right now.
>
> Be forewarned, those modules do *not* handle multi-line records. This
> is because CSV is not supposed to have embedded newlines. Microsoft
> ignores this restriction. I've worked around the problem in the past
> by assuming that any parsing error is a result of needing to include
> an additional line. This is a pretty brain-dead approach.
There was a thread about this not very long ago, in which I posted a
small code snippet that dealt with this in a similar but different way,
with slightly different assumptions.
The article with message id
Message-ID: <slrn9edftj.hu4.mgjv@martien.heliotrope.home>
contains the code.
Martien
--
Martien Verbruggen | Since light travels faster than
Interactive Media Division | sound, isn't that why some people
Commercial Dynamics Pty. Ltd. | appear bright until you hear them
NSW, Australia | speak?
------------------------------
Date: Sat, 12 May 2001 03:42:15 +0200
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Converting a tab-delimited file?
Message-Id: <9di4rh$i325p$1@ID-13368.news.dfncis.de>
"Ren Maddox" <ren@tivoli.com> wrote in
news:m34rutnldo.fsf@dhcp9-172.support.tivoli.com...
> On Thu, 10 May 2001, amnuts@talker.com wrote:
>
> > In article <d4alft80s81kitf52gpat9l7h6oott7m0j@4ax.com>,
> > bart.lateur@skynet.be says...
> >
> >> So, my advice is to look up the Text::CSV, or better yet, the
> >> Text::CSV_XS module. That'll help in getting the records read in
> >> properly.
> >
> > Great! I'll have a look into that right now.
>
> Be forewarned, those modules do *not* handle multi-line records.
It is Perl that insists to handle every newline it sees as a line
separator.
Text::CSV_XS _can_ handle records with multiline fields. From the
documentation:
new(\%attr)
(Class method) Returns a new instance of Text::CSV_XS. The
objects attributes are described by the (optional) hash ref
`\%attr'. Currently the following attributes are available:
[...]
binary If this attribute is TRUE, you may use binary characters
in quoted fields, including line feeds, carriage
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
returns and NUL bytes. (The latter must be escaped
^^^^^^^
as `"0'.) By default this feature is off.
The getline method in Text::CSV_XS can be used to autmatically
parse records containing multiline fields.
> This is because CSV is not supposed to have embedded newlines.
AFAIK there is no formal definition of the CSV format.
> Microsoft ignores this restriction.
No such restriction is needed if a 2-byte sequence (CRLF) is used as
the record separator in text files. Microsoft CSV files use LF as the
line separator within quoted fields and CRLF to separate records.
Back in January 2000 i posted something like the following example
using both the getline method (parse_csv_file_1) and something similar
to your solution (parse_csv_file_2), but with a (IMHO) somewhat better
error handling than yours:
---------------%<------------------------------------------------
The parse_csv_file_1() uses the getline method, which automatically
handles multiline fields.
The parse_csv_file_2() uses the parse method, which requires some
manual help to handle multiline fields (but it doesn't need the
same ugly way to detect the end-of-file condition as in the
first example ).
#!perl -w
use strict;
use Text::CSV_XS;
use IO::File;
sub parse_csv_file_1 {
my $file_name = shift; # name of file to parse
my $call_back = shift; # callback function to handle one
# line of parsed input
my $separator = shift || ',';
my $csv = Text::CSV_XS->new({ binary => 1,
sep_char => $separator,
});
my $fh = new IO::File;
open($fh, $file_name) or die "can't read $file_name: $!";
while (1) {
my $flds = $csv->getline($fh);
unless (defined($flds)) {
my $err = $csv->error_input();
die "CSV parse failed in $file_name at:\n", $err;
}
if (@$flds == 0) {
# end-of-file
last;
}
# do something with a successfully parsed line
$call_back->(@{$flds});
}
close($fh);
}
sub parse_csv_file_2 {
my $file_name = shift; # name of file to parse
my $call_back = shift; # callback function to handle one
# line of parsed input
my $separator = shift || ',';
my $csv = Text::CSV_XS->new({ binary => 1,
sep_char => $separator,
});
my $fh = new IO::File;
open($fh, $file_name) or die "can't read $file_name: $!";
my $buffer = "";
my $success = 0;
while (defined(my $line = <$fh>)) {
$buffer .= $line;
$success = $csv->parse($buffer);
if ($success) {
# do something with a successfully parsed line
$call_back->($csv->fields());
$buffer = "";
}
}
close($fh);
if (not $success) {
my $err = $csv->error_input();
die "parse CSV failed in $file_name at:\n", $err;
}
}
sub display_fields {
my @fields = @_;
print "-" x 20, " record ", "-" x 20, "\n";
foreach my $field (@fields) {
print $field, "\n";
}
print "-" x 48, "\n";
}
my $file_name = $ARGV[0];
# using the getline method
parse_csv_file_1($file_name, \&display_fields, "\t");
# using the parse method
parse_csv_file_2($file_name, \&display_fields, "\t");
__END__
------------------------------
Date: Fri, 11 May 2001 21:39:56 -0500
From: xris <xris@dont.send.spam>
Subject: DBI weirdness...
Message-Id: <xris-8E5A75.21395611052001@news.evergo.net>
ok, all of a sudden, some of my sql code just started doing weird stuff,
and it seems to be related to DBI (which is why I'm posting it here
instead of in an sql group)...
first of all:
Create Table CompanyVars (
var VarChar(48) Primary Key,
val Text Not Null
);
my code is as follows (more or less:
$sh = $dbh->prepare('REPLACE INTO CompanyVars (var,val) VALUES (?,?)');
foreach $var (keys %Company) {
#... do some stuff here to clean up
#... some of the vars to make them pretty
$sh->execute($var, $Company{$var});
print "'$var' -> '$Company{$var}'\n",
$sh->errstr, "\n";
}
$sh->finish;
This results in: (I added the separators to make it easier to read)
------------------------------------------------------------------------
'meta-usecatdescriptions' -> '1'
------------------------------------------------------------------------
'userwords' -> 'your company name, domain.com, www.domain.com'
You have an error in your SQL syntax near 'company name, domain.com,
www.domain.com)' at line 1
------------------------------------------------------------------------
'info' -> 'This information is shown to search engines as they catalog
your site. Please say something informative.'
You have an error in your SQL syntax near 'information is shown to
search engines as they catalog your site. Please say so' at line 1
------------------------------------------------------------------------
'ignoreordinals' -> '1'
------------------------------------------------------------------------
'ignorewords' -> 'pair, sale, item, this, that, the, their, can't, don't'
You have an error in your SQL syntax near '\'t, don\'t)' at line 1
------------------------------------------------------------------------
'maxwords' -> '100'
------------------------------------------------------------------------
correct me if I'm wrong, but isn't DBI supposed to examine each variable
individually when passed in as a replacement value? such that a word
like "don't" would get converted to "'don\'t'" ? It seems that when a
NUMBER is the first thing sent to execute(), all following parameters
are also treated as numbers (the errors go away if I don't evaluate the
numbers), and don't get the wrapping '' characters (but internal ' still
get convered to \' ). So, when I do something as simple as:
$sh->execute($var, "$Company{$var}");
the errors go away completely.
Maybe I'm just confused, but I'm pretty sure that the first bit of code
is SUPPOSED to work fine, regardless of what kind of data I'm sending
in, in whichever order.
Thanks,
Chris
------------------------------
Date: Fri, 11 May 2001 19:50:52 -0700
From: "rick@rickfrazier.com" <rick@rickfrazier.com>
Subject: DQ: Perl script vs perl.cgi
Message-Id: <3AFCA50B.14120902@rickfrazier.com>
I feel that this is going to be a really dumb question (DQ) once I know
the answer, but what is different about how the code should look in an
asp perl script and inside a .cgi ?...
I have a perl script in an .asp file running on a Windows IIS server
that uses aspmail to email some basic information. However, when I try
to put the script code in a .cgi file, it doesn't get executed. It's as
if
everything stalls at that point, as debugging print statements after the
code don't appear either.
The code in the .asp page is:
<%@ LANGUAGE = PerlScript %>
<%
$Mailer = $Server->CreateObject("SMTPsvg.Mailer");
$Mailer->{'FromName'} = 'ASP test file';
$Mailer->{'FromAddress'} = 'user@notmydomain.com';
$Mailer->{'RemoteHost'} = '99.99.99.99';
$Mailer->AddRecipient ('rick', 'rick@rickfrazier.com');
$Mailer->{'Subject'} = 'Test from ASP page';
$Mailer->{'BodyText'} = "This is a test message from
PerlScript\n\nRick";
if ($Mailer->SendMail())
{
$Response->write("Mail successfully sent");
}
else
{
$Response->write("Mail failure. Check mail host server name and
tcp/ip connection...\n");
$Response->write($Mailer->{'Response'});
}
%>
In the actual .asp script, the IP of the server I'm using is there.
(on a unix system, this code also works with mail.mydomain.com) Of
course, in the cgi script, I omit the <% and %> lines.
As I'm using an ISP with Win and IIS, the debugging resources are
nonexistent .
The debug "print" statements indicate everything is normal until the
first $Mailer line, then the cgi seems to
just quit operating (later print statements never appear).
Thanks
--rick
------------------------------
Date: Fri, 11 May 2001 21:53:47 -0400
From: Marshall Dudley <mdudley@execonn.com>
Subject: Forcing default filename
Message-Id: <3AFC97AB.DDB1EC23@execonn.com>
I have a utility written in perl that tars and gzips a backup to be
downloaded by a client of their webspace. It is working except for a
few minor details.
Right now it is writing the resulting .tar.gz file to a directory in the
download path, and using a Location: statement to direct the browser to
download the newly created file. There are two problems with this.
First the default filename for the file is showing up in the browser as
the name of the cgi program that created the file, instead of the name
of that actual file it is downloading in some browsers..
The second problem is that with the file in the download path, there is
a security issue where anyone could download the file until it is
deleted.
I can easily fix the second problem by having the cgi sen the
content-type header for application/x-compressed followed by the gzipped
file. But in that case the fioename to save will default to the cgi
script name, instead of the filename.
Is there any way to tag the filename to the transfer so that the browser
will default to the properl filename?
Thanks,
Marshall
------------------------------
Date: Fri, 11 May 2001 21:54:43 -0400
From: Marshall Dudley <mdudley@execonn.com>
Subject: Forcing default filename
Message-Id: <3AFC97E3.C813BB73@execonn.com>
I have a utility written in perl that tars and gzips a backup to be
downloaded by a client of their webspace. It is working except for a
few minor details.
Right now it is writing the resulting .tar.gz file to a directory in the
download path, and using a Location: statement to direct the browser to
download the newly created file. There are two problems with this.
First the default filename for the file is showing up in the browser as
the name of the cgi program that created the file, instead of the name
of that actual file it is downloading in some browsers.
The second problem is that with the file in the download path, there is
a security issue where anyone could download the file until it is
deleted.
I can easily fix the second problem by having the cgi sen the
content-type header for application/x-compressed followed by the gzipped
file. But in that case the fioename to save will default to the cgi
script name, instead of the filename.
Is there any way to tag the filename to the transfer so that the browser
will default to the properl filename?
Thanks,
Marshall
------------------------------
Date: Fri, 11 May 2001 21:56:21 -0400
From: Marshall Dudley <mdudley@execonn.com>
Subject: Forcing default filename
Message-Id: <3AFC9845.CE01A94D@execonn.com>
I have a utility written in perl that tars and gzips a backup to be
downloaded by a client of their webspace. It is working except for a
few minor details.
Right now it is writing the resulting .tar.gz file to a directory in the
download path, and using a Location: statement to direct the browser to
download the newly created file. There are two problems with this.
First the default filename for the file is showing up in the browser as
the name of the cgi program that created the file, instead of the name
of that actual file it is downloading in some browsers.
The second problem is that with the file in the download path, there is
a security issue where anyone could download the file until it is
deleted.
I can easily fix the second problem by having the cgi sen the
content-type header for application/x-compressed followed by the gzipped
file. But in that case the fioename to save will default to the cgi
script name, instead of the filename.
Is there any way to tag the filename to the transfer so that the browser
will default to the properl filename?
Thanks,
Marshall
------------------------------
Date: Fri, 11 May 2001 22:00:16 -0400
From: Marshall Dudley <mdudley@execonn.com>
Subject: Forcing default filename
Message-Id: <3AFC9930.28D6207E@execonn.com>
I have a utility written in perl that tars and gzips a backup to be
downloaded by a client of their webspace. It is working except for a
few minor details.
Right now it is writing the resulting .tar.gz file to a directory in the
download path, and using a Location: statement to direct the browser to
download the newly created file. There are two problems with this.
First the default filename for the file is showing up in the browser as
the name of the cgi program that created the file, instead of the name
of that actual file it is downloading in some browsers.
The second problem is that with the file in the download path, there is
a security issue where anyone could download the file until it is
deleted.
I can easily fix the second problem by having the cgi sen the
content-type header for application/x-compressed followed by the gzipped
file. But in that case the fioename to save will default to the cgi
script name, instead of the filename.
Is there any way to tag the filename to the transfer so that the browser
will default to the properl filename?
Thanks,
Marshall
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 880
**************************************