[17268] in Perl-Users-Digest
Perl-Users Digest, Issue: 4690 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 22 14:10:30 2000
Date: Sun, 22 Oct 2000 11:10:16 -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: <972238215-v9-i4690@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 22 Oct 2000 Volume: 9 Number: 4690
Today's topics:
Help: How do I debug Server Side Include HTML page? <boonteo@singnet.com.sg>
Re: Help: How do I debug Server Side Include HTML page? (David Efflandt)
Re: how do i find file size? <me@privacy.net>
Re: I need a source to paste data on another website (Clay Irving)
New to newsgroups (was Re: Array stuck within a loop) (Tad McClellan)
Re: Perl 5.005 or 5.6? <bart.lateur@skynet.be>
Re: Perl for PalmOS? (Dr. Joel M. Hoffman)
Perl interface for MySQL (Scott Roberts)
Re: posting variables.... simple question <flavell@mail.cern.ch>
Re: Rijndael in Perl (Rob Warnock)
Re: Rijndael in Perl (Martien Verbruggen)
Re: Rijndael in Perl (Logan Shaw)
RSSLite 0.06 <scott@industrial-linux.org>
Setting Output Field Separaters <jncannon@mindspring.com>
Re: Setting Output Field Separaters <jeffp@crusoe.net>
Re: Setting Output Field Separaters (Clay Irving)
Re: Setting Output Field Separaters (Tad McClellan)
Re: Setting Output Field Separaters (Logan Shaw)
Re: Simple file/open/print help please <ren.maddox@tivoli.com>
Re: Simple file/open/print help please (Tad McClellan)
Re: still need help/beginner....pulling my hair ! (Tad McClellan)
trying to open excel or pdf files in browsers using cgi <duocbtNOSPAM@pacific.net.au>
Re: trying to open excel or pdf files in browsers using <ubl@schaffhausen.de>
Re: trying to open excel or pdf files in browsers using (David Efflandt)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 22 Oct 2000 22:06:38 +0800
From: "Teo Keng Boon" <boonteo@singnet.com.sg>
Subject: Help: How do I debug Server Side Include HTML page?
Message-Id: <8sus37$sg2$1@coco.singnet.com.sg>
Hi all,
How do I debug a SSI HTML page? How do I know if my server is executing
mySSI? I have done the following according to the documentation.
1) I have check the httpd.conf file, the following settings are set
accordingly:
# To use server-parsed HTML files
AddType text/html .shtml
AddHandler server-parsed .shtml
2) My SHTML file (place in /usr/HTTPServer/htdocs) is as follow:
<HTML>
<HEAD>
<TITLE>Date Test</TITLE>
</HEAD>
<BODY>
The date is:
<!--#exec cmd = "date" -->
</BODY>
</HTML>
-- the file has the x-bit set for all groups
With 1) and 2) I still could not get it to work. So a .htaccess file is
place in /usr/HTTPServer/htdocs
3) The content of the .htaccess file is as follows:
<Directory "/usr/HTTPServer/htdocs">
Options +ExecCGI
</Directory>
With 1), 2) and 3) the SHTML is still does not work the way I want it to be.
What's wrong with the configurations or code, anybody has similar experience
before? Please help.
Thank you,
Keng Boon
------------------------------
Date: Sun, 22 Oct 2000 14:58:35 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Help: How do I debug Server Side Include HTML page?
Message-Id: <slrn8v604n.8f7.efflandt@efflandt.xnet.com>
On Sun, 22 Oct 2000, Teo Keng Boon <boonteo@singnet.com.sg> wrote:
>How do I debug a SSI HTML page? How do I know if my server is executing
>mySSI? I have done the following according to the documentation.
Apparently you selected the wrong newsgroup, there is no Perl question
here. Read the apache docs about mod_include and if you still have
questions, look for a *.www.servers.* newsgroup.
>1) I have check the httpd.conf file, the following settings are set
>accordingly:
># To use server-parsed HTML files
>AddType text/html .shtml
>AddHandler server-parsed .shtml
Does your page name end with .shtml?
>2) My SHTML file (place in /usr/HTTPServer/htdocs) is as follow:
><HTML>
><HEAD>
><TITLE>Date Test</TITLE>
></HEAD>
><BODY>
>The date is:
><!--#exec cmd = "date" -->
></BODY>
></HTML>
Works for me.
>-- the file has the x-bit set for all groups
That is meaningless unless you have XBitHack set to on or full, and I
think it does NOT work with suexec (which some Linux distros enable by
default). Simply ending the filename with .shtml should work.
>With 1) and 2) I still could not get it to work. So a .htaccess file is
>place in /usr/HTTPServer/htdocs
>
>3) The content of the .htaccess file is as follows:
><Directory "/usr/HTTPServer/htdocs">
>Options +ExecCGI
></Directory>
That even more meaningless since you have no CGI here.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Sun, 22 Oct 2000 14:17:11 GMT
From: "EM" <me@privacy.net>
Subject: Re: how do i find file size?
Message-Id: <HFCI5.7424$44.22261@news.iol.ie>
Thankyou for all your help
It works :)
And yes i wanted it to be saved on the server
------------------------------
Date: 22 Oct 2000 13:13:10 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: I need a source to paste data on another website
Message-Id: <slrn8v5pv6.838.clay@panix2.panix.com>
On Sun, 22 Oct 2000 00:56:51 GMT, programmer4k@my-deja.com
<programmer4k@my-deja.com> wrote:
^^^^^^^^^^
>Hello. I need a source
^^^^^^
--
Clay Irving <clay@panix.com>
I am built for comfort, not speed!
------------------------------
Date: Sun, 22 Oct 2000 08:11:18 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: New to newsgroups (was Re: Array stuck within a loop)
Message-Id: <slrn8v5mb6.dho.tadmc@magna.metronet.com>
On Sun, 22 Oct 2000 01:27:11 GMT, bhui <bhui_ipsg@yahoo.com> wrote:
>this has been my first post on a board
^^^^^^^
comp.lang.perl.misc is a Usenet newsgroup. It is not a "message board".
People new to this newsgroup thing should see the articles posted to:
news.announce.newusers
if they want to get the most from using Usenet.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 22 Oct 2000 12:07:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl 5.005 or 5.6?
Message-Id: <mel5vskup9satsghrmd7u08e4uqgpdcrtv@4ax.com>
Marc Fearby wrote:
>Should I stick with 5.005 (on Windows: ActivePerl 522) or upgrade to
>5.6 and just deal with all the problems?
You cannot use them both at once. That's BAD. The binary modules are not
compatible, but the files DO have the same name. So if you have a script
in perl 5.005 that uses a compiled module Foo::Bar, that will have
loaded the 5.005 version of Bar.dll.
Now, try to run a script in Perl 5.6 while the other one is still
running, that also uses the module Foo::Bar. This will attempt to load
the 5.6 version of Bar.dll . But Windows can only run one program (or
DLL) with the same name at the same time. So this will also use the DLL
from 5.005. Net effect: crash.
Worse: if you have a module Foo::Bar that uses *a* Bar.dll, and a module
Baz::Bar that uses a Bar.dll, well, you can't use both module at the
same time.
Er... isn't this the case with XML::Parser and HTML::Parser? ... No.
XML::Parser is based upon XML::Expat, so the DLL is expat.dll.
But I did find two File.dll files in my distribution: Win32::File and
Win32API::File. USing those two together, should be impossible.
>The Perl re-write that's supposed to be going on - will that be Perl 6?
>If so, would it be better to wait for that instead?
No. That's years away. You may expect the real successor of 5.6, namely
5.8 (5.7 is/will be an experimental release), to come out before that.
p.s. Personally I'm using 5.6. Only if there are some modules that you
*really* need that haven't been recompiled for 5.6 yet, then I'd stick
with 5.005.
--
Bart.
------------------------------
Date: Sun, 22 Oct 2000 17:59:04 GMT
From: joel@exc.com (Dr. Joel M. Hoffman)
Subject: Re: Perl for PalmOS?
Message-Id: <IVFI5.6$s62.131@client>
>It's coming I'm sure. Wouldn't be surprised to see this within two years.
>That would be way cool to carry my web server with me? Am I a geek or am
>I a geek? :)
Carrying a web server with you could actually be very useful. I'd
love to be able to do it on trips I lead, so that I could post trip
progress to a website and let people know what's going on.
-Joel
------------------------------
Date: Sun, 22 Oct 2000 16:52:41 GMT
From: scott@heelspurs.castrate.this.part.com (Scott Roberts)
Subject: Perl interface for MySQL
Message-Id: <39f319b9.20544308@news.knology.net>
Has anyone tried MysqlMan? It's a Perl version of PHPMySQL. A web
interface for administrating your MySQL databases.
Here's the source code and a demostration program:
http://gossamer-threads.com/scripts/mysqlman/
Any pro/con comments about? Security issues?
------------------------------
Date: Sun, 22 Oct 2000 11:44:30 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: posting variables.... simple question
Message-Id: <Pine.GHP.4.21.0010221133240.3563-100000@hpplus03.cern.ch>
On Sun, 22 Oct 2000, Michel Wouterse wrote:
> Is there a way to post values from a perl cgi into another perl cgi?
Is there a way to read previous answers to this frequently asked CGI
question?
CGI specifies a programming interface between your process and a web
server. Perl is a programming language.
> PS: or is there a way to make a form with different actions
> (login.cgi-signup.cgi-delete.cgi) depending on which submitbutton you click?
Is there a way to read previous answers to this frequently asked CGI
question?
comp.infosystems.www.authoring.cgi is the group about authoring CGI
for the WWW: be sure to read its FAQs first.
Once you've understood the CGI issues, you perhaps may be left with a
Perl-relevant question that would be on-topic on this Perl-language
(comp.lang.perl.misc) group.
Since you already said that you consider this to be a simple question,
it's hard to understand why you thought it appropriate to ask the
world-wide Perl community without first doing some elementary
homework. Usenet helps those who show that they are trying to play
their own part in the relationship. Have fun.
------------------------------
Date: 22 Oct 2000 11:41:48 GMT
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Subject: Re: Rijndael in Perl
Message-Id: <8sujps$op7r$1@fido.engr.sgi.com>
Vernon Schryver <vjs@calcite.rhyolite.com> wrote:
+---------------
| Rob Warnock <rpw3@rigden.engr.sgi.com> wrote:
| >Most Unixes -- e.g., Linux, FreeBSD, SGI's Irix, many others -- have
| >"mlock(2)" or "mpin(2)" or "plock(2) ...
|
| Yes, but do those functions guarantee that memory will never be
| written to some kind of backing store?
+---------------
Good point. However, if it's a system based on good general design
principles in mind (oh, well, maybe that leaves out Windwow), one
would hope that writing a pinned page to backing store would be
considered "inefficient" and "uneccessary", and never be done.
Then there's the issue of trusting that the "pin" function actually
even works at all! E.g., it might be hard from a user program to tell
the difference between a true "pin" and an implementation that merely
assigns a very high priority for the page remaining in memory (but
still allows swapping under certain overload conditions).
I suppose one would have to check on a system-by-system basis.
The sources for {Free,Net,Open}BSD & Linux are readily available,
but for Irix, Solaris, Windows...?
-Rob
p.s. Of course, if so you'd still have to wipe each such page before
unpinning it (even by accident, as with a program crash!) to be sure
that it wasn't swapped in the brief interval between unpinning and
program exit.
-----
Rob Warnock, 31-2-510 rpw3@sgi.com
Network Engineering http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. PP-ASEL-IA
Mountain View, CA 94043
------------------------------
Date: Mon, 23 Oct 2000 00:20:30 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Rijndael in Perl
Message-Id: <slrn8v5qcu.k23.mgjv@martien.heliotrope.home>
On 22 Oct 2000 11:41:48 GMT,
Rob Warnock <rpw3@rigden.engr.sgi.com> wrote:
> Vernon Schryver <vjs@calcite.rhyolite.com> wrote:
> +---------------
> | Rob Warnock <rpw3@rigden.engr.sgi.com> wrote:
> | >Most Unixes -- e.g., Linux, FreeBSD, SGI's Irix, many others -- have
> | >"mlock(2)" or "mpin(2)" or "plock(2) ...
> |
> | Yes, but do those functions guarantee that memory will never be
> | written to some kind of backing store?
> +---------------
> Then there's the issue of trusting that the "pin" function actually
> even works at all! E.g., it might be hard from a user program to tell
> the difference between a true "pin" and an implementation that merely
> assigns a very high priority for the page remaining in memory (but
> still allows swapping under certain overload conditions).
I don't know about the other ones, but the behaviour of mlock is defined
in the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995). Part of its
reason for existence was to provide something slightly safer for
security reasons. The other part was to stop applications with real-time
needs from being swapped out.
I'd say that every system that implements mlock, and claims POSIX
compliance has no other choice but to behave correctly on this.
But we're now getting so far offtopic from clp.misc, and probably for
sci.crypt as well, that the discussion maybe should be shifted to an OS
group or standards group that can give some more authoritative opinions
on these functions.
Martien
--
Martien Verbruggen |
Interactive Media Division | We are born naked, wet and hungry.
Commercial Dynamics Pty. Ltd. | Then things get worse.
NSW, Australia |
------------------------------
Date: 22 Oct 2000 11:56:05 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Rijndael in Perl
Message-Id: <8sv675$ork$1@provolone.cs.utexas.edu>
In article <8sujps$op7r$1@fido.engr.sgi.com>,
Rob Warnock <rpw3@rigden.engr.sgi.com> wrote:
>Good point. However, if it's a system based on good general design
>principles in mind (oh, well, maybe that leaves out Windwow), one
>would hope that writing a pinned page to backing store would be
>considered "inefficient" and "uneccessary", and never be done.
Well, it's conceivable that it might not. What if you do I/O to your
swap space in blocks of 64k (to reduce overhead) and your MMU maps
things in blocks of 8k and you have a chunk of memory like this:
0k non-pinned block
8k non-pinned block
16k non-pinned block
24k non-pinned block
32k non-pinned block
40k pinned block
48k non-pinned block
56k non-pinned block
In this case, if you want to swap out the 7 blcoks which
aren't pinned in memory, it would probably be a little more
efficient to write out the whole 64k at once. Plus, if that
8k block later becomes swappable, then you've already reserved
space for in swap and this might make the mapping between the
process's address space and swap space easier to manage.
I don't know that there actually is such an
implementation, but there could be, and as long as you
don't know, you kind of have to assume the worst.
Getting back to Perl issues, even if you do manage by some
gymnastics to lock the appropriate pages in memory so that a Perl
scalar isn't swappable, what if you make the scalar larger? Perl
might reallocate it somewhere else in memory that isn't locked.
So, there are Perl issues even if you can get a given scalar
locked in memory. You probably could get around these issues by
(1) pre-loading the scalar with enough garbage bytes so that it
will not have to be expanded to store its actual data, and then
(2) using syscall() to lock the pages in memory, and then (3)
never assigning anything to that scalar that's larger than it
already is. But, I'm not even sure that's exactly right.
- Logan
------------------------------
Date: Sat, 21 Oct 2000 15:00:50 -0600
From: "Scott Thomason" <scott@industrial-linux.org>
Subject: RSSLite 0.06
Message-Id: <sv60kssjdutoec@corp.supernews.com>
Greetings, I think I have something to offer the world...a new Perl module
that makes retrieving useful RSS content easier. Instead of using
XML::Parser-based code, which chokes on the impure XML created by the
world at large, it uses "relaxed" algorithms.
You can take a peek at the module and a sample program using it at:
http://industrial-linux.org/RSSLite/
Changes have been made in version 0.06 to make it parse RSS of the style
found at http://www.kuro5hin.org/backend.rdf ... notably, it now simplifies tag
names by removing the "rss091:" from tags like
"<rss091:language>en</rss091:language>", and it now properly handles
self-terminating tags such as
"<inchannel rdf:resource="http://www.kuro5hin.org/" />".
I appreciate your feedback.
---scott thomason
=== Info ===
Name : Scott Thomason
Email : scott@industrial-linux.org
Website : industrial-linux.org
UserID : SCOTTHOM
CPAN desc : XML::RSSLite bdpf
Extract broken XML from RSS/RDF/SN/WL format
Background : After recently reading about XML::RSS, I decided to give it a
try. Several hours later, I was still only capable of extracting about 40%
of the open content cataloged at xmltree.com. I realized that the
majority of open content syndicators are not very good at writing valid RSS
XML.
My goal is to write a module that extracts all the open content that is
available, and be much less concerned about XML compliance. This module
currently parses all but a handful of the XML URLs cataloged at
xmltree.com. Rather than rely on XML::Parser, it uses heuristics and good
old-fashioned Perl regular expressions. It stores the data in a simple
hash structure, and "aliases" certain tags so that when done, you can
count on having the minimal data necessary for re-constructing a valid
RSS file. This means you get the basic title, description, and link for a
channel and its items. Anything else present in the hash is a bonus :)
This module extracts more usable links by parsing "scriptingNews" and
"weblog" formats in addition to RDF & RSS. It also "sanitizes" the
output for best results. The munging includes:
- Removing html tags to leave plain text
- Eliminating objectionable characters
- Using <url> tags when <link> is empty
- Using misplaced urls in <title> when <link> is empty
- Ripping links from <a href=...> if required
- Limiting content to http/ftp links
- Joining relative urls to the site base
------------------------------
Date: Sun, 22 Oct 2000 09:08:40 -0400
From: "orantor" <jncannon@mindspring.com>
Subject: Setting Output Field Separaters
Message-Id: <8sunv2$iip$1@slb3.atl.mindspring.net>
I am writing records to files from arrays and need to set the field
separeters to ",". It seems that the default is a single space between
fields or array items. I read somewhere that you could set $OFS (like in
awk) but am not sure how to do this.
thanks for any help - jcannon
------------------------------
Date: Sun, 22 Oct 2000 09:18:21 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Setting Output Field Separaters
Message-Id: <Pine.GSO.4.21.0010220917230.25707-100000@crusoe.crusoe.net>
On Oct 22, orantor said:
>I am writing records to files from arrays and need to set the field
>separeters to ",". It seems that the default is a single space between
>fields or array items. I read somewhere that you could set $OFS (like in
>awk) but am not sure how to do this.
Read perldoc perlvar and look for $, (the output field separator
variable). Here's an example usage:
@array = (1..3);
print @array; # 123
{ local $, = ", "; print @array; } # 1, 2, 3
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: 22 Oct 2000 13:24:25 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: Setting Output Field Separaters
Message-Id: <slrn8v5qk9.838.clay@panix2.panix.com>
On Sun, 22 Oct 2000 09:08:40 -0400, orantor <jncannon@mindspring.com> wrote:
>I am writing records to files from arrays and need to set the field
>separeters to ",". It seems that the default is a single space between
>fields or array items. I read somewhere that you could set $OFS (like in
>awk) but am not sure how to do this.
Try:
perldoc perlvar
Result:
$OUTPUT_FIELD_SEPARATOR
$OFS
$, The output field separator for the print operator.
Ordinarily the print operator simply prints out
its arguments without further adornment. To get
behavior more like awk, set this variable as you
would set awk's OFS variable to specify what is
printed between fields. (Mnemonic: what is
printed when there is a "," in your print
statement.)
Note: Setting the output field separator to "," isn't necessarily going to
produce a CSV file, if that's the intention.
--
Clay Irving <clay@panix.com>
PUSH, n. One of the two things mainly conducive to success, especially in
politics. The other is Pull.
- Ambrose Bierce
------------------------------
Date: Sun, 22 Oct 2000 10:33:53 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Setting Output Field Separaters
Message-Id: <slrn8v5umh.er1.tadmc@magna.metronet.com>
On Sun, 22 Oct 2000 09:08:40 -0400, orantor <jncannon@mindspring.com> wrote:
>I read somewhere that you could set $OFS (like in
>awk) but am not sure how to do this.
use English;
$OFS = ':'; # print colons between list elements
or
$, = ':';
>thanks for any help
You are expected to check the Perl docs before posting to the
Perl newsgroup. We are not here to read the docs to you.
'perlvar.pod' documents Perl's special variables. You could
have found the answer more quickly than posting if you had
searched for '$OFS' there instead.
When you know how to do something in awk and want to know how
to do the same thing in Perl, then write it in awk and run it
through the 'a2p' translator that comes with the perl distribution.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 22 Oct 2000 12:10:15 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Setting Output Field Separaters
Message-Id: <8sv71n$p3u$1@provolone.cs.utexas.edu>
In article <8sunv2$iip$1@slb3.atl.mindspring.net>,
orantor <jncannon@mindspring.com> wrote:
>I am writing records to files from arrays and need to set the field
>separeters to ",". It seems that the default is a single space between
>fields or array items. I read somewhere that you could set $OFS (like in
>awk) but am not sure how to do this.
Several others have already mentioned "$,", so I won't describe it, but
I will mention that another solution is to just use join() instead. I
personally find this easier and clearer. An example:
perl -le 'print join (",", qw{ a b c })'
This will print "a,b,c".
Hope that helps.
- Logan
------------------------------
Date: 21 Oct 2000 22:10:12 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Simple file/open/print help please
Message-Id: <m31yx9woyz.fsf@dhcp11-177.support.tivoli.com>
jxavier@jxavier.vservers.com (jxavier) writes:
> Still new to perl, going good back can't get a simple print to file to
> work: Can someone tell me what I'm doing wrong please cause I cant
> figure it out =( Here's the script:
First, the answer is that you aren't opening the file for writing,
just for reading. [perldoc -f open]
Now, since you are still new to Perl, we might as well get you off to
a good start.
The most important lesson, particularly when you are still learning,
is that you should enable warnings, strict mode, and probably
diagnostics, just for good measure. Note that strict mode is going to
require you to be more explicit about some things -- particularly
variables, which you will normally want to "my"... [perldoc strict,
perldoc -f my]
#!/usr/local/bin/perl -w
use strict;
use diagnostics;
> print "Please enter your name";
> $name = <STDIN>;
With strict enabled, this will need to be:
my $name = <STDIN>;
Also, <> can be used in place of <STDIN>.
> chop $name;
chomp is better for trimming newlines -- it doesn't really matter for
simple cases like this, but it will save you from accidently chopping
off an important character when you expected there to be a newline but
there wasn't. [perldoc -f chomp]
In addition, you can combine these two lines into:
chomp(my $name = <>);
> system("touch /usr/local/testperl/namefile");
You won't need to do this once you change the open to write mode.
> $namer="/usr/local/testperl/namefile";
> open LNAME, $namer or die "File $namer Does Not Exist";
As mentioned, here is your problem. You need to open the file in
write mode and this just opens it in read mode. Also, you should
include $! in that die message so that if there is a problem, you get
a clue as to what it is:
open LNAME, ">$namer" or die "Could not open $namer for writing, $!";
> print LNAME "$name";
As you likely realize, this quotes are unnecessary:
print LNAME $name;
> close LNAME;
HTH,
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Sun, 22 Oct 2000 10:39:58 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Simple file/open/print help please
Message-Id: <slrn8v5v1u.er1.tadmc@magna.metronet.com>
On Sun, 22 Oct 2000 05:28:21 GMT, Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "j" == jxavier <jxavier@jxavier.vservers.com> writes:
>
> j> open LNAME, $namer or die "File $namer Does Not Exist";
>
>you didn't open the file for output.
You were not working smart then.
You should get as much help as you can in finding common
programming mistakes (such as writing to a filehandle opened
for reading).
Enabling warnings will help you find common programming mistakes.
If you had enabled warnings, perl would have told you in
*milliseconds* what your problem was.
How many milliseconds did it take you to get the answer by
posting to Usenet? (use exponential notation please :-)
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 22 Oct 2000 10:46:59 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: still need help/beginner....pulling my hair !
Message-Id: <slrn8v5vf3.er1.tadmc@magna.metronet.com>
On Sun, 22 Oct 2000 00:17:09 -0400, none <none@nospam.com> wrote:
>I have 10
>years of Cobol, CICS, VSAM, DB2 and would blow your doors off there and make
>you look like a fool.
Oh. Your daddy can beat up Uri's daddy.
Snappy comeback. We are impressed with you now.
[ snip Jeopardy quote of 100 lines ]
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 22 Oct 2000 23:15:06 +1000
From: "Duoc B T" <duocbtNOSPAM@pacific.net.au>
Subject: trying to open excel or pdf files in browsers using cgi
Message-Id: <39f2e63b.461d8@nancy.pacific.net.au>
hi all,
i am pulling my hair trying to get my cgi to open an excel or pdf file in
the browser. i've tried many things unsuccessfully. this is one of the
versions of my getfile.cgi :
#!/usr/cgi-bin/perl
print ("Content-Disposition: attachment; filename=testfile.xls\n");
print ("Pragma: no-cache\n");
print ("Cache-Control: no-cache\n");
print( "Content-type: application/octet-stream\n\n");
exit;
when i called my getfile.cgi, the download window pops up asking if i want
to open or save. this is not my intention. i want it to open automatically
in the browser (like a usual link). but still, when i choose open, excel
opens the file with the contents missing. any help is appreciated.
duoc b t
------------------------------
Date: Sun, 22 Oct 2000 16:21:46 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: trying to open excel or pdf files in browsers using cgi
Message-Id: <39F2F7FB.6A992F23@schaffhausen.de>
Duoc B T schrieb:
>
> hi all,
>
> i am pulling my hair trying to get my cgi to open an excel or pdf file in
> the browser. i've tried many things unsuccessfully. this is one of the
> versions of my getfile.cgi :
>
> #!/usr/cgi-bin/perl
>
> print ("Content-Disposition: attachment; filename=testfile.xls\n");
> print ("Pragma: no-cache\n");
> print ("Cache-Control: no-cache\n");
> print( "Content-type: application/octet-stream\n\n");
> exit;
>
> when i called my getfile.cgi, the download window pops up asking if i want
> to open or save. this is not my intention. i want it to open automatically
> in the browser (like a usual link). but still, when i choose open, excel
> opens the file with the contents missing. any help is appreciated.
>
> duoc b t
print "Content-type: application/pdf\n\n";
This should work fine for PDF. Forget the other headers. If you want to know
the correct MIME type for a file format look it up in your browser's settings.
Your next problem will be that the downloaded file will have the wrong extension.
So what you might want to do is to redirect the browser to the location
of the file
to be downloaded.
Hope this helps,
malte
--
$me = Person->new("Malte Ubl");
$me->comp ("Schaffhausen | Interactive");
$me->job ("Developer for web-based Applications");
$me->phone("+49 4121 472964");
$me->fax ("+49 4121 472938");
exit; # reference count = 0 -> $me->DESTROY
------------------------------
Date: Sun, 22 Oct 2000 15:08:57 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: trying to open excel or pdf files in browsers using cgi
Message-Id: <slrn8v60o5.8f7.efflandt@efflandt.xnet.com>
On Sun, 22 Oct 2000, Duoc B T <duocbtNOSPAM@pacific.net.au> wrote:
>
>i am pulling my hair trying to get my cgi to open an excel or pdf file in
>the browser. i've tried many things unsuccessfully. this is one of the
>versions of my getfile.cgi :
>
>#!/usr/cgi-bin/perl
>
>print ("Content-Disposition: attachment; filename=testfile.xls\n");
>print ("Pragma: no-cache\n");
>print ("Cache-Control: no-cache\n");
>print( "Content-type: application/octet-stream\n\n");
>exit;
>
>when i called my getfile.cgi, the download window pops up asking if i want
>to open or save. this is not my intention. i want it to open automatically
>in the browser (like a usual link). but still, when i choose open, excel
>opens the file with the contents missing. any help is appreciated.
You apparently neglected to open, read and send (print) the file contents
from your script, so what contents do you expect excel to open?
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
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 4690
**************************************