[13804] in Perl-Users-Digest
Perl-Users Digest, Issue: 1214 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 29 00:06:30 1999
Date: Thu, 28 Oct 1999 21:05:58 -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: <941169958-v9-i1214@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 28 Oct 1999 Volume: 9 Number: 1214
Today's topics:
Re: "require" encourages non-portable code?? (Abigail)
Re: $50 for solution to this <ramvinod@eng.umd.edu>
Re: $formdata=~s/\s+$//; ? <cassell@mail.cor.epa.gov>
Re: $formdata=~s/\s+$//; ? (Brian StJohn)
Re: $formdata=~s/\s+$//; ? (Craig Berry)
Re: $formdata=~s/\s+$//; ? (Tad McClellan)
Re: adding data to beginning of file <aqumsieh@matrox.com>
Re: adding data to beginning of file <lr@hpl.hp.com>
Re: adding data to beginning of file (Martien Verbruggen)
Re: Can find (a,b) differentiate btn a and b directorie <cassell@mail.cor.epa.gov>
Re: Capture HTML tags. (Park, Jong-Pork\)
Re: COM automation server in Perl? <cassell@mail.cor.epa.gov>
Re: comparing text with words (Abigail)
control characters from perl TCP read/write <NOSPAMjeff.broitman@NOSPAMcybertrust.gte.com>
DBD::Oracle make test problem <arvindk@altavista.com>
does file exist <mlankamp@hotmail.com>
Re: does file exist (Greg Bacon)
Re: does file exist <maurice.maltbia@intel.com>
Re: does file exist <lr@hpl.hp.com>
Re: does file exist (Tad McClellan)
Re: FAQ 3.20: How can I make my CGI script more efficie <cassell@mail.cor.epa.gov>
Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? <jon@midnightbeach.com>
Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? <slanning@bu.edu>
Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? <tlewis@gte.com.*remove*>
Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? <lee@insync.net>
Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? <slanning@bu.edu>
Re: file sorting,, repeated <gellyfish@gellyfish.com>
Forcing a download <preble@ipass.net>
Re: Forcing a download (Martien Verbruggen)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Oct 1999 17:19:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: "require" encourages non-portable code??
Message-Id: <slrn81hive.66b.abigail@alexandra.delanet.com>
Kirk Is (kisrael@andante.cs.tufts.edu) wrote on MMCCXLIX September
MCMXCIII in <URL:news:7v9r76$pb4$1@news3.tufts.edu>:
`` I'm trying to get a good explanation for why "require" can't use the
`` "current script location" rather than the "current working directory" for
`` relative paths, and if there is some equivalent "include" command that
`` would allow my code to be moved from one directory to another without
`` breaking or forcing a ENV change.
``
`` Here's the situation, and it doesn't seem that uncommon to me:
`` I have a series of scripts in a directory. For the sake of argument,
`` let's say that they are all in my ~/scripts directory, and that each
`` script depends on "common.perl" that's in that same directory to run.
``
`` Now, it's not enough to just put
`` require "common.perl";
`` in each file that needs it, because then I have to type
`` cd ~/scripts
`` ./script.perl
`` to run it (or have to change my ENV to include that directory)
``
`` It seems to me like it would be a good thing to have the script location
`` as part of the search path as well, not just the cwd.
``
`` This code
`` 0 =~ /^(.*\/).*?$/;
I guess that's a '$0'.
`` $scriptdir = $1;
``
`` require $scriptdir."run_common.perl";
``
`` seems to work, though is not extremely robust.
That of course doesn't work at all if the program is in your PATH.
`` Is there a better way to make a directory of codependent scripts portable,
`` so that I could move the kit-and-kaboodle with impunity, without having to
`` redo my ENV or change the scripts themselves?
No. It's the same problem with dynamic libraries. You cannot put them in
random places either, without changing your environment variables.
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 28 Oct 1999 18:08:46 -0400
From: Vinodh R Cuppu <ramvinod@eng.umd.edu>
To: newsmf@bigfoot.com, ramvinod@eng.umd.edu
Subject: Re: $50 for solution to this
Message-Id: <3818C96E.3827A29E@eng.umd.edu>
Hello there,
if no one has answered your question yet,
add "Encoding => 'quoted-printable'" to your attachment and/or main
message. this encoding supports 8bit text and long lines and does not chop
lines to legal limit.
Cheers
Vinod
> Here's the problem: it seems that some lines in the text are getting
> broken apart by randomly inserted carriage returns. The lines in
> question come up with exclamation marks just before the carriage
> return. This causes html to be displayed improperly and, worse, nasty
> Javascript errrors if the inserted exclamation marks and carriage
> returns fall inside an html page's javascript code.
------------------------------
Date: Thu, 28 Oct 1999 16:50:28 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: $formdata=~s/\s+$//; ?
Message-Id: <3818E144.AC155372@mail.cor.epa.gov>
Yeong Mo/Director Hana co. wrote:
>
> Hi,
>
> What is "/\s+$//;" ?
>
> $formdata=~s/\s+$//;
>
> Someone please explain this ?
I believe this has been explained to you. But that explanation
won't help with your next problem. I think you've posted a
number of times before. You may benefit from working through
this tutorial:
http://www.netcat.co.uk/rob/perl/win32perltut.html
and then buying one of the "Learning Perl" books by Randal
Schwartz.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 29 Oct 1999 03:59:13 GMT
From: bsj@fc.hp.com (Brian StJohn)
Subject: Re: $formdata=~s/\s+$//; ?
Message-Id: <7vb62h$7p4$1@fcnews.fc.hp.com>
Yeong Mo/Director Hana co. (hmaster@factory.co.kr) wrote:
: Hi,
: What is "/\s+$//;" ?
: $formdata=~s/\s+$//;
: Someone please explain this ?
\s matches a space, \s+ matches any number of spaces,
and $ anchors the RE to the end of the string.
Cheers,
Brian
------------------------------
Date: Thu, 28 Oct 1999 20:03:16 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: $formdata=~s/\s+$//; ?
Message-Id: <s1hb04dmr0864@corp.supernews.com>
boris_bass@my-deja.com wrote:
: if I have a string with multiple newlines and I want to get
: rid of all of them , should I use /s or /m modifier?
No.
You should use tr/\n//d .
: $mystringwithmanynewlines=~s/\s+$/m/
: or
: $mystringwithmanynewlines=~s/\s+$/s/
Those aren't how you use /m and /s modifiers, anyway. The lines above
would replace trailing whitespace/newline on the string with the letter
'm' or 's' respectively.
: What is the meaning of /s and /m modifiers, I could never figure
: that out exactly?
Here the doc is admittedly a bit thick. In a nutshell (tim):
Normally, . matches any character but newline, and ^ and $ only match at
the beginning and end of the string as a whole. /s cause . to match
newline (in addition to all other characters, while /m causes ^ and $ to
match at internal newlines in addition to the string endpoints.
This little example program demonstrates the differences which occur.
Note that I'm using the (?m) and (?s) syntax to put the modifiers inside
the match pattern, but these behave the same as putting /m and /s at the
end. Hope this helps!
#!/usr/bin/perl -w
# msex - /m and /s example
# Craig Berry (19991028)
use strict;
my $str = <<EOS;
This is some
multiline text
that we can try
to match.
EOS
my @regexes = ('.+', '(?s).+', '^.+', '(?m)^.+');
foreach my $re (@regexes) {
print "$re :\n";
my @matches = $str =~ m/$re/g;
foreach my $match (@matches) {
$match =~ s/\n/\\n/g; # Make newlines visible.
print " $match\n"
}
}
__END__
Output (note that each match appears on its own line, with internal
newlines rendered visibly as \n):
.+ :
This is some
multiline text
that we can try
to match.
(?s).+ :
This is some\nmultiline text\nthat we can try\nto match.\n
^.+ :
This is some
(?m)^.+ :
This is some
multiline text
that we can try
to match.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Thu, 28 Oct 1999 11:46:00 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: $formdata=~s/\s+$//; ?
Message-Id: <o3r9v7.q2h.ln@magna.metronet.com>
boris_bass@my-deja.com wrote:
: if I have a string with multiple newlines and I want to get
: rid of all of them , should I use /s or /m modifier?
: $mystringwithmanynewlines=~s/\s+$/m/
replace whitespace at the end of the string with the letter 'm'.
: or
: $mystringwithmanynewlines=~s/\s+$/s/
replace whitespace at the end of the string with the letter 's'.
*Neither* of those use the /s or /m modifiers!
: What is the meaning of /s and /m modifiers, I could never figure
: that out exactly?
s///s modifies the meaning of dot (.) in your regex.
It allows dot to match a newline character.
It has no effect if there is no dot.
s///m modifies the meaning of anchors ( ^ and $ )
It allows anchors to match "interior" line starts/ends.
It has no effect if there are no anchors.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 28 Oct 1999 14:22:22 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: adding data to beginning of file
Message-Id: <x3yiu3r8hwl.fsf@tigre.matrox.com>
Aaron Walker <amwalker@gate.net> writes:
> First of all, I have not read the Perl FAQ. I thought we were just supposed to
> read the comp.lang.perl.misc FAQ. Anyways, so I headed over to section 5 of
> the Perl FAQ and checked out the appropriate section. The way I am currently
> accomplishing this is follows: (no error checking for simplicity)
Error checking is ALWAYS a good idea. Even with simple examples like
this.
> --
The above line usually indicates that everything below it part of the
signature. It caused my newsreader to treat the rest of your post as a
signature. It's not harmful, but try to avoid that please.
> #!/usr/bin/perl -w
>
> $datafile = "/www/cgi-bin/file.dat";
>
> open(FILE, "$datafile");
... or die $!;
> @data = <FILE>;
> close(FILE);
... or die $!;
> open(FILE, ">$datafile");
... or die $!;
> print FILE "Entry 1";
> print FILE @data;
> close(FILE);
... or warn $!;
> -
>
> Is this the wrong way to go about accomplishing this task? It seems much
> easier (or at least, easier to read).
If your datafile is small, then you can sure go ahead and use your
code. It's ok. But, there are other considerations that might become
problems depending on your situation.
The most serious of which is the size of your datafile. You program
reads the whole thing into memory. While this is ok for small files,
it will consume a lot of memory for large files.
The solution for this would be to create a temporary file, print
everything you want to it, and then rename it to the original file
name:
open TMP, "> tempfile" or die $!;
open FILE, $datafile or die $!;
print TMP "Entry 1\n";
print TMP for <FILE>;
close TMP or die $!;
close FILE or die $!;
rename "tempfile", $datafile;
This create a new file, prints to it your data, then reads your
datafile line by line, and prints into the new file. Finally, if all
is fine, it renames your temp file into the original name.
There is a small issue here of choosing a good name for the temp
file. You don't want to accidentally choose the name of an existing
file and overwrite its data. But that's another issue that is
addressed in the FAQs.
HTH,
--Ala
------------------------------
Date: Thu, 28 Oct 1999 14:12:02 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: adding data to beginning of file
Message-Id: <MPG.12825bfa9af61ad798a153@nntp.hpl.hp.com>
In article <x3yiu3r8hwl.fsf@tigre.matrox.com> on Thu, 28 Oct 1999
14:22:22 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
...
> The most serious of which is the size of your datafile. You program
> reads the whole thing into memory. While this is ok for small files,
> it will consume a lot of memory for large files.
...
> print TMP for <FILE>;
...
> This create a new file, prints to it your data, then reads your
> datafile line by line, and prints into the new file. Finally, if all
> is fine, it renames your temp file into the original name.
Right idea, wrong implementation.
print TMP for <FILE>
creates a list consisting of every line of the file, then prints each
element of the list. So the whole file has been read into memory at one
swallow.
What you really need there is:
print TMP while <FILE>;
Scalar context instead of list context. A subtle but crucial
distinction.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 28 Oct 1999 22:14:37 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: adding data to beginning of file
Message-Id: <hV3S3.60$fq3.1742@nsw.nnrp.telstra.net>
On Thu, 28 Oct 1999 08:52:19 -0400,
Jeff Pinyan <jeffp@crusoe.net> wrote:
> On Oct 28, Govindaraj blah blah blah:
>
> > open(INFILE, "<$ARGV[0]") || die "Cannot Open the Input File $!\n";
> > open(OUTFILE, ">$ARGV[1]") || die "Cannot Open the Input File $!\n";
>
> methinks you copied and pasted.
>
> > if ( (!$ARGV[0]) || (!$ARGV[1]) )
>
> so I can't operate on a file called "0"? I'd suggest:
>
> if (@ARGV != 2)
And I'd suggest doing this test before the opens above :)
Martien
--
Martien Verbruggen |
Interactive Media Division | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd. | bundled with your Microsoft product.
NSW, Australia |
------------------------------
Date: Thu, 28 Oct 1999 16:48:14 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Can find (a,b) differentiate btn a and b directories ?
Message-Id: <3818E0BE.EDF2E7A8@mail.cor.epa.gov>
Adrian Chin wrote:
>
> Hi
>
> I wanted to know if any way that I can differentiate btn a and b
> directories and the files within a and b as well ?
>
> I want to write a script that do a compare btn each files within a and b
> directories.
No problem. Just take a look at the answer I posted in your *other*
thread. Just remember, Usenet is not an instantaneous medium,
and Usenet responders are not Instant Quaker Oats. You can't
expect instant turn-around.. because we're more like slow-cooked
oats.. because we're often really burned around here.. and there's
a lot of flaming around the edges.. and sometimes the replies
are rather thick and opaque, even if full of bubbly goodness.
Hmm, how far can I stretch this gloppy simile?
> Thanks
You're welcome,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 29 Oct 1999 06:59:30 +0900
From: "นฺมพบน \(Park, Jong-Pork\)" <okpolis@okclub.com>
Subject: Re: Capture HTML tags.
Message-Id: <RmV1HAZI$GA.249@news.thrunet.com>
Sorry. I write again
I tried this.
$file = "<A href="http...">Link site name1</A> or next <A href...>Link2</A>";
$file .= "and <A href...>Link3</A>";
$regexp = '<A(.*?)>(.*?)<\/A>'; # fixed.
foreach $tmp ($file =~ /$regexp/is) {
print "$tmp\n";
}
I hope this print result, "Link site name1\nLink2\nLink3".
BUT it work "Link site name1</A> or next <A ...>Link2</A> and\nLink3";
What I need to change?
Thank you.
------------------------------
Date: Thu, 28 Oct 1999 17:19:27 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: COM automation server in Perl?
Message-Id: <3818E80F.3DA21417@mail.cor.epa.gov>
Domenico Viggiani wrote:
>
> Can I use COM automation server with Activestate Perl?
Yes.
> I'm not speaking about OLE but another kind of object (thanks Bill :-( )
Scott MacMahan just wrote an entire book on this subject.
Search deja.com's archives for his postings in this newsgroup
over the aslt couple months.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 28 Oct 1999 16:41:12 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: comparing text with words
Message-Id: <slrn81hgmq.66b.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCCXLIX September MCMXCIII in
<URL:news:MPG.12822f1d2262795f98a14e@nntp.hpl.hp.com>:
..
..
.. Distinguishing a quotable bareword from a function call requires
.. knowledge of whether a subroutine declaration has been encountered
.. during the compilation to this point, including all included files. Use
.. of an undeclared identifier as a bareword in normal program contexts
.. would be caught by 'use strict qw(subs);'. But in hash keys or left of
.. =>, nothing will save you.
It used to give a warning. But nowadays, it doesn't.
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 28 Oct 1999 16:30:53 -0400
From: "J.Z> Brody" <NOSPAMjeff.broitman@NOSPAMcybertrust.gte.com>
Subject: control characters from perl TCP read/write
Message-Id: <3818B27D.E3B69E2D@NOSPAMcybertrust.gte.com>
Perhaps you've seen this?
Using an IO::Socket connection I'm passing data back and forth and
getting some control character with the newline (\n) as well...
EG:
print $HANDLE "What is your name: ";
$response = <$HANDLE>
____
I split it to an array to look at it char by char...
Here's how I printed it out.
foreach $item (@array){
print "[$item]\n";
}
____
Here's what I got for "foo"
[f]
[o]
[o]
][
[
]
_____
How is the ][ being printed out? The char's are being REVERSED (?!)
with a control character? The last thing is a newline (\n), what is the
thing before it?
.Brody
------------------------------
Date: Thu, 28 Oct 1999 15:56:04 -0700
From: Arvind Krishnaswamy <arvindk@altavista.com>
Subject: DBD::Oracle make test problem
Message-Id: <3818D484.A026CE4B@altavista.com>
I m trying to install DBD::Oracle after installing DBI and make test
keeps failing (as below). I have set ORACLE_HOME, ORACLE_SID,
ORACLE_USERID. This is on Digital UNIX 4.0.D with Perl 5.00502,
DBI-1.13 and DBD-Oracle-1.03 and Oracle 8.0.5 . I also 'undid' the
setuid bit as given in the README.sec file
but perl Makefile.PL still gives a warning on the Oracle Security
problem.. Is this OK?
Any help welcome..
Thanks
Arvind
PERL_DL_NONLAZY=1 /usr/local/bin/perl5.00502 -Iblib/arch -Iblib/lib
-I/digital/a
lpha/lib/perl5/5.00502/alpha-dec_osf -I/digital/alpha/lib/perl5/5.00502
-e 'use
Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/base..............install_driver(Oracle) failed: Can't load
'blib/arch/auto/DB
D/Oracle/Oracle.so' for module DBD::Oracle: dlopen: cannot load
blib/arch/auto/D
BD/Oracle/Oracle.so at
/digital/alpha/lib/perl5/5.00502/alpha-dec_osf/DynaLoader
.pm line 168.
at (eval 1) line 2
at t/base.t line 17
dubious
Test returned status 2 (wstat 512, 0x200)
Number found where operator expected at (eval 372) line 1, near ")0"
(Missing operator before 0?)
Number found where operator expected at (eval 373) line 1, near ")1"
(Missing operator before 1?)
Number found where operator expected at (eval 374) line 1, near ")2"
(Missing operator before 2?)
Number found where operator expected at (eval 375) line 1, near ")3"
(Missing operator before 3?)
DIED. FAILED tests 4-5
test2.pv.pa.alta-vista.net# make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl5.00502 -Iblib/arch -Iblib/lib
-I/digital/a
lpha/lib/perl5/5.00502/alpha-dec_osf -I/digital/alpha/lib/perl5/5.00502
-e 'use
Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/base..............install_driver(Oracle) failed: Can't load
'blib/arch/auto/DB
D/Oracle/Oracle.so' for module DBD::Oracle: dlopen: cannot load
blib/arch/auto/D
BD/Oracle/Oracle.so at
/digital/alpha/lib/perl5/5.00502/alpha-dec_osf/DynaLoader
.pm line 168.
at (eval 1) line 2
at t/base.t line 17
dubious
Test returned status 2 (wstat 512, 0x200)
Number found where operator expected at (eval 372) line 1, near ")0"
(Missing operator before 0?)
Number found where operator expected at (eval 373) line 1, near ")1"
(Missing operator before 1?)
Number found where operator expected at (eval 374) line 1, near ")2"
(Missing operator before 2?)
Number found where operator expected at (eval 375) line 1, near ")3"
(Missing operator before 3?)
DIED. FAILED tests 4-5
Failed 2/5 tests, 60.00% okay
t/general...........install_driver(Oracle) failed: Can't load
'blib/arch/auto/DB
D/Oracle/Oracle.so' for module DBD::Oracle: dlopen: cannot load
blib/arch/auto/D
BD/Oracle/Oracle.so at
/digital/alpha/lib/perl5/5.00502/alpha-dec_osf/DynaLoader
.pm line 168.
at (eval 1) line 2
at t/general.t line 20
dubious
Test returned status 2 (wstat 512, 0x200)
Undefined subroutine &Test::Harness::WCOREDUMP called at
/digital/alpha/lib/perl
5/5.00502/Test/Harness.pm line 288.
*** Exit 2
Stop.
------------------------------
Date: Thu, 28 Oct 1999 22:05:00 +0200
From: "Michiel Lankamp" <mlankamp@hotmail.com>
Subject: does file exist
Message-Id: <3818ac9e$0$24792@reader1.casema.net>
How can I check if a file exists on disk?
Thankz
------------------------------
Date: 28 Oct 1999 20:12:05 GMT
From: gbacon@ruby.itsc.uah.edu (Greg Bacon)
Subject: Re: does file exist
Message-Id: <7vaaml$5mh$1@info2.uah.edu>
In article <3818ac9e$0$24792@reader1.casema.net>,
"Michiel Lankamp" <mlankamp@hotmail.com> writes:
: How can I check if a file exists on disk?
Ask the operating system. What documentation have you read in trying to
solve your problem?
Greg
--
Cop: McManus told us another story altogether.
Fenster: Is that the one about the hooker with dysentery?
------------------------------
Date: Thu, 28 Oct 1999 13:30:42 -0700
From: "Maurice Maltbia" <maurice.maltbia@intel.com>
Subject: Re: does file exist
Message-Id: <7vabp4$31i@news.or.intel.com>
$file = "foo.pl";
if (-e $file) {
print "Yup, it exists.\n";
print "See chapter 10 of Learning Perl, 2nd Edition\n"
}
Michiel Lankamp wrote in message <3818ac9e$0$24792@reader1.casema.net>...
>How can I check if a file exists on disk?
>
>Thankz
>
>
------------------------------
Date: Thu, 28 Oct 1999 17:10:47 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: does file exist
Message-Id: <MPG.128285e4d499596798a158@nntp.hpl.hp.com>
In article <7vabp4$31i@news.or.intel.com> on Thu, 28 Oct 1999 13:30:42 -
0700, Maurice Maltbia <maurice.maltbia@intel.com> says...
> $file = "foo.pl";
> if (-e $file) {
> print "Yup, it exists.\n";
> print "See chapter 10 of Learning Perl, 2nd Edition\n"
> }
That code makes some assumptions about the current directory that may
not be warranted.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 28 Oct 1999 16:38:43 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: does file exist
Message-Id: <j8cav7.fdh.ln@magna.metronet.com>
Michiel Lankamp (mlankamp@hotmail.com) wrote:
: How can I check if a file exists on disk?
^^^^^^^^^^^
cd /where/perl's/pods/are/
grep -i 'file exists' *.pod
perlfunc.pod: -e File exists.
duh.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 28 Oct 1999 17:14:10 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Tom and Gnat <perlfaq-suggestions@perl.com>
Subject: Re: FAQ 3.20: How can I make my CGI script more efficient?
Message-Id: <3818E6D2.1932D521@mail.cor.epa.gov>
[email to perlfaq-suggestions as well]
Tom Christiansen wrote:
>
> (This excerpt from perlfaq3 - Programming Tools
> ($Revision: 1.38 $, $Date: 1999/05/23 16:08:30 $)
> part of the standard set of documentation included with every
> valid Perl distribution, like the one on your system.
> See also http://language.perl.com/newdocs/pod/perlfaq3.html
> if your negligent system adminstrator has been remiss in his duties.)
>
> How can I make my CGI script more efficient?
[big snip]
> A non-free, commercial product, ``The Velocity Engine for Perl'',
> (http://www.binevolve.com/ or http://www.binevolve.com/bine/vep)
> might also be worth looking at. It will allow you to increase the
> performance of your perl scripts, upto 25 times faster than normal
> CGI perl by running in persistent perl mode, or 4 to 5 times faster
> without any modification to your existing CGI scripts. Fully
> functional evaluation copies are available from the web site.
Another product in the same category is PerlEx from
ActiveState (http://www.activestate.com/plex/) which
is designed to run on all the major commercial webservers
on Win NT. Tests run by ActiveState suggest that, depending
on the script, PerlEx can give a speed-up of up to 48x.
PerlEx keeps Perl in memory between invocations of Perl
scripts. In addition to keeping a number of Perl
interpreters resident in memory, PerlEx also compiles and
stores in memory any Perl scripts that are run by these
interpreters. A Perl CGI program running under PerlEx
can take advantage of persistent data. For example, a
single database connection can be made when a script is
first executed, and the resulting database handle can be
used in subsequent invocations of the script, thus avoiding
having to make further expensive database connections.
This is all cribbed from the ActiveState site.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 28 Oct 1999 12:16:05 -0700
From: Jon Shemitz <jon@midnightbeach.com>
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <3818A0F5.415CF0C1@midnightbeach.com>
Tom Christiansen wrote:
> Is there an IDE or Windows Perl Editor?
>
> If you're on Unix, you already have an IDE -- Unix itself.
Wow, I never expected to find humor on c.l.p.m!
> PerlBuilder (XXX URL to follow) is an integrated development
> environment for Windows that supports Perl development.
http://www.solutionsoft.com/perl.htm
PerlBuilder sounds like a great idea - but in practice, it needs work.
Code that loads without warning and runs perfectly well under
ActiveState's Perl generates a pageful of warnings when you try to run
it under PerlBuilder. Its idea of using HTML files as templates for CGI
scripts is to embed them in your code as a raft of print 'XXX'
statements! Somehow, it seems more sensible to me to keep the templates
in separate files, and do a bunch of s/PLACEHOLDER/$content/e ops;
easier to read your code, and easier to modify the templates.
--
http://www.midnightbeach.com - Me, my work, my writing, and
http://www.midnightbeach.com/hs - my homeschool resource pages
------------------------------
Date: 28 Oct 1999 16:09:15 -0400
From: Scott Lanning <slanning@bu.edu>
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <kusiu3rgsd0.fsf@strange.bu.edu>
Jon Shemitz <jon@midnightbeach.com> writes:
> Tom Christiansen wrote:
> > If you're on Unix, you already have an IDE -- Unix itself.
>
> Wow, I never expected to find humor on c.l.p.m!
What do you mean? There are jokes here all the time.
However, although Tom is always joking around (<grin>),
I don't consider that a joke. Unix (with emacs for
some, vi for others) is easily the most kickass IDE there
is, especially for C and Perl.
--
"If there were gods, how could I bear to be no god?
Consequently there are no gods." --Nietzsche
------------------------------
Date: Thu, 28 Oct 1999 16:33:00 -0400
From: Tim Lewis <tlewis@gte.com.*remove*>
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <7vabs4$sv7$1@news.gte.com>
Scott Lanning wrote:
>
> Jon Shemitz <jon@midnightbeach.com> writes:
> > Tom Christiansen wrote:
> > > If you're on Unix, you already have an IDE -- Unix itself.
>
> I don't consider that a joke. Unix (with emacs for
> some, vi for others) is easily the most kickass IDE there
> is, especially for C and Perl.
ed has those wimpy visual editors beat hands down!
ed is the standard text editor!!!!
(Heh, heh, somebody had to say it)
;-)
Tim Lewis
------------------------------
Date: Thu, 28 Oct 1999 15:50:44 -0500
From: "Lee Sharp" <lee@insync.net>
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <EG2S3.10818$Ph7.74268@insync>
Tim Lewis wrote in message <7vabs4$sv7$1@news.gte.com>...
|ed has those wimpy visual editors beat hands down!
|ed is the standard text editor!!!!
|(Heh, heh, somebody had to say it)
You kids today have it easy. I remember when we had to write programs
with an ice pick and index cards. <Note: This joke is not Y2k compliant.
Soon people will ask, "What's an ice pick?" >
Lee
--
SCSI is *NOT* magic. There are *fundamental technical reasons* why it is
necessary to sacrifice a young goat to your SCSI chain now and then. * Black
holes are where God divided by zero. - I am speaking as an individual, not
as a representative of any company, organization or other entity. I am
solely responsible for my words.
------------------------------
Date: 28 Oct 1999 22:43:37 -0400
From: Scott Lanning <slanning@bu.edu>
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <kusiu3qlwdi.fsf@bottom.bu.edu>
"Lee Sharp" <lee@insync.net> writes:
> Tim Lewis wrote in message <7vabs4$sv7$1@news.gte.com>...
> |ed has those wimpy visual editors beat hands down!
> |ed is the standard text editor!!!!
>
> You kids today have it easy. I remember when we had to write
> programs with an ice pick and index cards.
You got an ice pick?!?
Why we had to use a cigarette lighter...in a blizzard!
--
qualification: I'm a dimwit according to someone who emailed me
------------------------------
Date: 28 Oct 1999 21:23:07 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: file sorting,, repeated
Message-Id: <7vaerr$138$1@gellyfish.btinternet.com>
On Thu, 28 Oct 1999 11:45:34 -0700 Larry Rosler wrote:
> [Posted and a courtesy copy mailed.]
>
> In article <3818126a_1@newsread3.dircon.co.uk> on 28 Oct 1999 10:07:54
> +0100, Jonathan Stowe <gellyfish@gellyfish.com> says...
>
> ...
>
>> @rate = map { substr($_, 1 + rindex $_,"\0" ) }
>> sort { $b <=> $a }
>> map { (split /;/)[5] . "\0" }
>> <FILE>;
>>
>> (Sorry Larry but I just had to lose those '=>' )
>
> That's not all you lost. You also lost the concatenation of the input
> line, so that the data make it through to the end.
>
Oooh so I did - thats what comes from typing things in myself and
not cutting an pasting :%-
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Thu, 28 Oct 1999 22:02:02 -0400
From: "E. Preble" <preble@ipass.net>
Subject: Forcing a download
Message-Id: <vb7S3.885$A3.1874@news.ipass.net>
I have an autoforwarding script that forwards to a
downloadable file (after counting a hit to it). The
forwarding part of the script is:
print "Content-type: text/html\n";
print "Location: $DownloadFile\n\n";
The problem is that with Netscape, if the MIME type of the
file isn't defined properly on the server, Netscape will not
prompt to download the file, but rather display the file
(which will be garble). With a link, the file can be forced
to download with a Shift-Click on the link. Is it possible
to mimic this behavior with the PERL print commands?
A default solution is to simply forward to a page that says
"Press shift and click this link for your download", but it
would be nice to make it automatic.
Thanks ahead.
Edward Preble
--
Datatrend Software
http://www.datatrendsoftware.com
mailto:info@datatrendsoftware.com
Grab It! Graph Digitizer for MS Excel
Double Check It Products
AutoMail Scripts for Website Automation
----------------------------------------------------
------------------------------
Date: Fri, 29 Oct 1999 02:14:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Forcing a download
Message-Id: <Qp7S3.202$fq3.6130@nsw.nnrp.telstra.net>
On Thu, 28 Oct 1999 22:02:02 -0400,
E. Preble <preble@ipass.net> wrote:
> I have an autoforwarding script that forwards to a
> downloadable file (after counting a hit to it). The
> forwarding part of the script is:
>
> print "Content-type: text/html\n";
> print "Location: $DownloadFile\n\n";
>
> The problem is that with Netscape, if the MIME type of the
Using perl to print this stuff to a browser does not change the fact
that it is totally unrelated to perl. I could write the same two lines
in a lot of other programming languages, and the problem would stay
exactly the same. If you can replace 'Perl' in your question with the
name of another programming language, then your question isn't about
Perl.
It is, in fact, about HTTP, and probably about some browser dependent
behaviour. You should therefore be able to get better answers to
questions like this in one of the comp.infosystems.www.* groups, where
they talk about anything related to the WWW.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
NSW, Australia |
------------------------------
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 1214
**************************************