[15534] in Perl-Users-Digest
Perl-Users Digest, Issue: 2944 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 4 06:05:29 2000
Date: Thu, 4 May 2000 03:05:14 -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: <957434714-v9-i2944@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 4 May 2000 Volume: 9 Number: 2944
Today's topics:
A problem about setuidperl! <peter@perfectlink.com.hk>
BUG? Get comand line parameter with ActiveState Perl <enders@mail.sub.uni-goettingen.de>
Re: CGI.pm tactics of mistake <nospam@devnull.com>
Re: confusing backtracking <fjherna@europa3.com>
Re: DOS-ify / Mac-ify output files <gellyfish@gellyfish.com>
Re: DOS-ify / Mac-ify output files (Villy Kruse)
Re: Error Trapping <gp_svnNOgpSPAM@yahoo.com.invalid>
FileHandle->new_tmpfile fails on Solaris 7 - possibly O <chris@cjx.com>
finding and replacing a string <richard_quick@quick2001.freeserve.co.uk>
Re: FYI : Compiling Perl to EXE (Windows or UNIX) exhacker@my-deja.com
get the mails from the inbox in unix k_ahg@my-deja.com
Re: get the mails from the inbox in unix exhacker@my-deja.com
How can I install perl modules under Windows ? <fyd@u-picardie.fr>
Re: how do I catch user's input? <gellyfish@gellyfish.com>
How to find a matching ")"? <r19610@email.sps.mot.com>
Re: http:request et Firewall <gellyfish@gellyfish.com>
Re: if file already exists then remove... <you.will.always.find.him.in.the.kitchen@parties>
Re: if file already exists then remove... (Villy Kruse)
Re: Installing modules with CPAN <gellyfish@gellyfish.com>
Re: Killing a query with DBI/DBD <gellyfish@gellyfish.com>
Re: migrate modules to perl5.6.0 <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 4 May 2000 04:26:15 +0800
From: "Peter Tang" <peter@perfectlink.com.hk>
Subject: A problem about setuidperl!
Message-Id: <8erbfi$t1c$1@hfc.pacific.net.hk>
I have a program which have the permission 4755(rwsr-xr-x) and owned by
root,
the program will create a '.forward' file in user's directory.
All user's directory is owned by nobody and have permission (rwxr-xr-x).
But when a execute the program, the following error will appear "Insecure
Dependency in open while running setuid ...".
Pls help!
------------------------------
Date: Thu, 04 May 2000 10:30:32 +0100
From: Markus Enders <enders@mail.sub.uni-goettingen.de>
Subject: BUG? Get comand line parameter with ActiveState Perl
Message-Id: <39114338.7E809AC3@mail.sub.uni-goettingen.de>
Hi,
I'm using ActiveState Perl for Windows (running on NT 4.0 SP5). Mostly
my small programs and scripts for inhouse use a run from the command
line. This worked for quite a while.
Then I updated my computer with ActiveStatePerl 5.6. The result was:
I do not get any command line input in my Perl program. I mean, the ARGV
variables are empty. The perl script does not get any parameters from
the command line. Even programs, which worked before (on an older
version) won't work anymore.
This happened 4 or 5 weeks ago and I though it could be a bug in
ActivePerl 5.6. But as long as I donot use my programs in the production
process, it was not that improtant for me. Well anyhow: Yesterday
somebody used one of my programs on a different computer with an older
ActivePerl version 5.005_03 (build 522). His machine is also running
under Windows NT 4, SP5.
Suddenly the same problem occured. He ran the script several times - it
behaved correctly. Than he opened the script in a text editor to print
it (while it was running) but did not save it. The result of the current
run was also okay.
But the next time, the script did not get the command line parameters
anymore. Even a simple -h (which should print the help) doesn't work. It
is the same effect as on my computer (with the newer perl version).
The surprising thing is: Other programs (non perl scripts) still get
their parameters from the command line (on both computer). On our other
machines, everything (perl scripts and other command line programs)
still work fine.
Is there any help? Or any idea? HELP... Never had such problems with
perl (not ActivePerl) under linux...
Thanx in advance
Ciao
Markus
------------------------------
Date: 4 May 2000 07:41:47 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: CGI.pm tactics of mistake
Message-Id: <8er9jr$9as$0@216.155.32.166>
In article <slrn8h2754.cq9.efflandt@efflandt.xnet.com>,
efflandt@xnet.com wrote:
| On 4 May 2000 04:53:57 GMT, The WebDragon <nospam@devnull.com>
| wrote:
| >I'm currently working on a small portion of what is eventually
| >going to be a rather complicated script.. (see 'portion' below)
| >
| >what I need to do next, is
| >
| > o to set things up so that the values that are input are
| > checked, and limited to being in the range of 0 .. 10
| >
| > o if they are out of range, I need to have a warning in the 2nd
| > half that not only tells the user to re-submit, but also
| >
| > o disables the 2nd submit button
|
| Why print it at all if you want it disabled?
to indicate that submission isn't possible, visually, until the errors
are corrected, but that's a thought and I'll mull it over. =)
| > o uses the entered values in the original fields as the new
| > 'defaults' (I seem to have the understanding that this is how
| > CGI.pm works unless I use -override switches. true?)
|
| You might want to set the field labels to red or otherwise mark the ones
| that need to be corrected.
yeah but it's checking the proper range that's one of the problems I
still have yet to solve :)
| > o makes the warning go away when the user re-submits the correct
| >value and re-enables the 2nd submit button.
|
| Resubmission should use the same routine as the original submission, so
| that should not be a problem.
yup
| > o enters those values into the %scoresG hash for further
| > calculation
| >later on in the script. (the reason why I'm not just using them
| >straight from param($key) is that there are TWO sets in the final
| >project, %scoresG and %scoresE, that have different multipliers
| >individually and different weightings when combined into an
| >aggregate.)
| >
| >I have yet to a second submit button below to pass on the
| >'accepted' values, obviously ;)
| >
| >I'm also having rather a bitch of a time getting tables to format
| >within the foreach thing, and the CGI.pm pod documentation is
| >strangely lacking some detail in the creation of tables. Either
| >that or I'm just flat-out blind. heh :)
|
| Yes, it would be nice if there were start_table() and end_table tags
| (which there may be in some CGI.pm version newer than 2.42). But until
I'm using 2.66 here.
from the pod documentation inside:
=item 1. start_table() (generates a <TABLE> tag)
=item 2. end_table() (generates a </TABLE> tag)
=item 3. start_ul() (generates a <UL> tag)
=item 4. end_ul() (generates a </UL> tag)
so, it seems as though that's been resolved. :) Time to update your copy
;) here's the url for you to save you the trouble of having to look it
up (I had the file open anyway :) http://stein.cshl.org/WWW/software/CGI/
| then, push the rows to a list as needed and then print the
| table(Tr([@list])) at the end.
|
| If you want to align different columns differently just use a td([]) for
| each cell separated by a dot, with rows separated by a comma:
|
| push @list,
| td({align=>'right'},['Label 1']) . td([textfield('name1')]),
| td({align=>'right'},['Label 2']) . td([textfield('name2')]);
let me try writing this, and I'll follow up with a repost if I can't get
it to work.. seems a bit cumbersome on reflection, however.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Thu, 4 May 2000 11:46:17 +0200
From: Javier Hernandez <fjherna@europa3.com>
To: Rick Delaney <rick.delaney@home.com>
Subject: Re: confusing backtracking
Message-Id: <Pine.LNX.4.21.0005041143430.1081-100000@tinerfe.dgac.dom>
On Tue, 2 May 2000, Rick Delaney wrote:
>>> You know, it would be really cool if someone could make a program
>>> would trace the execution of a regular expression through a string in
>>> easy-to-understand visual way.
> > That would be a wonderfull thing=A1=A1=A1 but ...
> There is use re 'debugcolor'. Tom might not think it an
> easy-to-understand visual solution but it may help you a little.
=20
> Of course, you probably didn't mean to leave off the /x modifer (which
> is why there are all those matches of EXACT < >, i.e. spaces) but I'll
> leave it to you to try
> perl -Mre=3Ddebug -e '"a b x//c /x e x/"=3D~m{([^/] | [^x]/)*}x'
> If you follow through that one you will really get a feel for
> backtracking.
=20
Hi Rick,
It worked really fine.
You have gave me a really nice tool to understanding Perl Regex Bactracking=
=2E
Now I can compare the Perl Regex Backtracking with the backtracking done
by "brain Regex engine". It is really nice.
Thanks so much,
Best regards,
Javi, _____ fjherna@europa3.com
| http://www.europa3.com/users/fjherna/
\_________(_)_________/ http://www.valux.org/
____________!___!___!___________ Valencia(Spain)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Learning without thought is labor lost;
thought without learning is perilous.
=09=09-- Confucius
------------------------------
Date: Thu, 04 May 2000 08:43:04 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DOS-ify / Mac-ify output files
Message-Id: <sKaQ4.62$a2.13290@news.dircon.co.uk>
On Thu, 4 May 2000 08:57:30 +0200, Michael Schlueter Wrote:
> With unix there are two converting programs, dos2ux and ux2dos .
>
[gellyfish@orpheus gellyfish]$ ux2dos
bash: ux2dos: command not found
It might be duconv, xtod or one of any number of things. I would suggest
Tom Christiansen's nlcvt <http://language.perl.com/ppt/src/nlcvt/> if a
Perl solution is required (and if it isnt why is the question being asked
here).
/J\
------------------------------
Date: 4 May 2000 08:47:33 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: DOS-ify / Mac-ify output files
Message-Id: <slrn8h2e95.s8f.vek@pharmnl.ohout.pharmapartners.nl>
On Thu, 4 May 2000 08:57:30 +0200,
Michael Schlueter <michael.schlueter@philips.com> wrote:
>With unix there are two converting programs, dos2ux and ux2dos .
>
>
Make that "some unix systems" as this is far from being universal.
Villy
------------------------------
Date: Tue, 02 May 2000 04:56:48 -0700
From: Gp <gp_svnNOgpSPAM@yahoo.com.invalid>
Subject: Re: Error Trapping
Message-Id: <296ee7ec.462a909a@usw-ex0109-068.remarq.com>
Is there any utility is available for tracing the variable
and steps as in the case of Turbo C++. I so kindly reply to
my question.
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Thu, 04 May 2000 09:19:48 +0100
From: Chris <chris@cjx.com>
Subject: FileHandle->new_tmpfile fails on Solaris 7 - possibly OT
Message-Id: <10E52B0E0DEA4006.851E2102738B7B68.600039CE856992E2@lp.airnews.net>
I have a problem which has got me completely baffled - I don't
know where to look next to try and find a solution - any ideas
would be greatly appreciated!
I am running the CPAN MIME::Tools modules to extract binary files from
incoming emails. My code is called directly from a sendmail alias
defined in /etc/aliases, thus:
upload: "| /usr/local/bin/upload"
/usr/local/bin/upload contains:
#!/usr/local/bin/perl -w
use MIME::Parser;
my $parser=MIME::Parser->new(output_dir=>"/usr/web/lib/tmp");
my $entity=$parser->read(\*STDIN) or die("Cannot read incoming data");
... more code follows ...
However, this fails inside the call to $parser->read with the
following obscure message:
couldn't open tmpfile! at
/usr/local/lib/perl5/site_perl/5.005/MIME/ParserBase.pm
line 530, <STDIN> chunk 23.
Looking through the source to ParserBase.pm, I find that this is
failing on a call to FileHandle->new_tmpfile
However, I can't find out why... I can't find out what file
new_tmpfile is trying to create, or why it is failing.
Other things I have found:
* This only fails when called from sendmail - if I run it from the
shell it works fine
* /usr/web/lib/tmp is world-writeable (but I don't think it ever gets
as far as accessing this).
* Only fails on Solaris - works fine on a Linux box
* Works when run suid to root, but I *really* dont want to do this...
* Perl version 5.005_03, MIME::Tools version 4.124
------------------------------
Date: Thu, 4 May 2000 09:41:56 +0100
From: "Richard Quick" <richard_quick@quick2001.freeserve.co.uk>
Subject: finding and replacing a string
Message-Id: <8ercv7$9h7bk$1@fu-berlin.de>
Hi,
We have been given permission to harvest content off a horoscope site, but
we need to change some of the imagery.
I have the following Perl script , which harvests the content from the site.
All the pictures are referenced absolutely
(http://www.awebsite.com/neo/images/pic.gif), and so I want to be find all
the instances of
awebsite.com/neo/images/
and replace them with
ourwebsite.com/images/
can anybody help me?
Cheers,
Rich
Here's the script.
#!/usr/bin/perl -w
use LWP::Simple;
&get_form;
$URL = 'http://www.awebsite.com/neo/today/ari.htm';
$content = get($URL);
print "Content-type: text/html\n\n";
print "$content";
# this part will get the amount of bytes of the url :
# my $bytes;
# $bytes = lenght $content;
# this part will get the amount of lines of the url :
# my $lines;
# $ lines = ($content =~ tr/\n/\n/);
exit;
sub get_form {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; }
else { $INPUT{$name} = $value; }
}
}
------------------------------
Date: Thu, 04 May 2000 08:52:01 GMT
From: exhacker@my-deja.com
Subject: Re: FYI : Compiling Perl to EXE (Windows or UNIX)
Message-Id: <8erdnd$av4$1@nnrp1.deja.com>
In article <Pine.GSO.4.10.10005031048020.13677-
100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
> On Wed, 3 May 2000 exhacker@my-deja.com wrote:
>
> > On one of my web-robot scripts that involved contacting http servers
> > repeatedly, the Executable version ran 56-58% *faster* than the Perl
> > version, and took up less memory (Perl takes up 4-8MB easily).
>
> > Here's the link: http://www.dynamicstate.com/perl2exe.htm
>
> I'm suspicious of your claim. It may be true, but I'm still
suspicious.
> That's a pretty amazing increase in speed. Do you have a program you
can
> make available (in both source and "compiled" form) which shows this
kind
> of speed increase?
I have to admit I'm still somewhat green when it comes to Perl.
My algorithms get complex and hairy, and I end up using nested
loops to take advantage of the default variable. One difference
that may explain the speed increase is this:
My algorithm does three major steps while parsing the data from
the webserver. Two of them write to files, and another is a
complex array & hash step involving sorting on keys and boolean
pattern matching. Basically, when you run the Perl version from
the command prompt, I can see on my internet monitor that "spikes"
occur, instead of the almost-steady stream of the compiled version.
A particalur extraction used to take about 6-7 1/2 hours, averaging
20K/s. Now, with the compiled version, it takes 3-4 1/2 hours,
averaging above 30K/s. I neglect to release the source, for it is
proprietary. But with the slight decrease in size, I was able to
run 6 copies of the program instead of 4. That alone increased my
extraction rate by 50%. And then take into account the decreased
latency (or maybe increased speed) which was upped by 50%. So, on the
same hardware, I've been able to extract 225% more than before
this program.
But I do see your point. With a standard dialup, there may be no
noticeable increase in download speed. That has too many factors
for me to go into. I do have a DSL connection, and I see 200K/s
often enough to know that lag is not the problem in this case.
> Part of what makes me so suspicious is that much of the time used by a
> program which contacts http servers repeatedly is likely to be netlag.
> Compiling won't help that.
> Another part of what makes me so suspicious is this statement from the
> pxman.htm document which comes with perl2exe:
> 3. Perl2Exe performance
> Programs created with Perl2Exe will run at about the same
> speed as perl scripts run with the standard interpreter.
> So the publisher of the software isn't claiming the kind of speed
> increase you're claiming.
I can't speak for the author of any software but my own. But I know
that with a high-speed, low-latency network, small increases in speed
come to light after a few hours of downloading.
Now you've got me on the fence. Okay ppl, you've got only one example
here of an increase in speed for compiled versions. Maybe it's that my
algorithm needs to be split up into dozens of subroutines. On one
hand, you have algorithm complexity, file access times, network
latency, etc. On the other hand, you have the size of the interpreter,
be it the compiled version, or the modules/libraries/functions that
Perl puts into memory. There are a lot of factors, and the way it
turned out for me, it was a definite advantage over my peers.
exhacker
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 04 May 2000 07:22:19 GMT
From: k_ahg@my-deja.com
Subject: get the mails from the inbox in unix
Message-Id: <8er8f1$5h5$1@nnrp1.deja.com>
hi,
I'm actually trying to write a perl program to grep certain mails in
my inbox in unix to do some processing.Is it possible to do that can
anybody help me.
thanx!
Kenneth
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 04 May 2000 08:26:07 GMT
From: exhacker@my-deja.com
Subject: Re: get the mails from the inbox in unix
Message-Id: <8erc6k$97d$1@nnrp1.deja.com>
In article <8er8f1$5h5$1@nnrp1.deja.com>,
k_ahg@my-deja.com wrote:
> hi,
>
> I'm actually trying to write a perl program to grep certain mails in
> my inbox in unix to do some processing.Is it possible to do that can
> anybody help me.
>
> thanx!
>
> Kenneth
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Kenneth,
I hope this helps and is not too confusing. It's kinda crude, but hey.
These are the assumptions I made:
- The name of the file containing your messages is inboxfile in the
current directory
- You want to append all messages containing your pattern to a file
call outputfile in the current directory
#############################
open(INBOX,"<inboxfile");
$wantthis="no";
while(<INBOX>) { # Read in the inbox, line by line
chomp; # Remove the line returns
if(/Received: from/) { # The beginning of each message
if($wantthis=="yes") {
# At this point, the entire message is in the array @message, and
# we do a logic step to see if the message contained the pattern.
# If the pattern existed, then $wantthis will be "yes".
print "Printing Message #$messagecount to outputfile\n";
open(OUT,">>outputfile");
print OUT @message;
close OUT;
}
$messagecount++;
@message=();
$wantthis="no";
}
push(@message); # push each line of the message into an array
if(/pattern/) {
$wantthis="yes";
}
}
close INBOX;
@message=0;
$wantthis=0;
@messagecount=0;
#############################
this script has no error handling, and is meant to be more of a
skeleton than a workhorse.
You could make the pattern to match an argument on the command line by
using $ARGV . And of course you could alter the script to offer
multiple string matching, boolean logic...
You probably don't want to write every one of those messages to another
file, but again, just making assumptions.
exhacker
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 04 May 2000 12:02:20 +0200
From: Francois Dupradeau <fyd@u-picardie.fr>
Subject: How can I install perl modules under Windows ?
Message-Id: <39114AAC.CD88C1A4@u-picardie.fr>
Hello !
I made a perl script under Linux and now I'd like to run it under
Windows NT. The problem is I must install some modules (HotKey.pm and
ANSIColor.pm). I can't install these modules because I can't do a make
and make install.
Can I can install these modules ? How ?
Can you give me an URL where I can download executables modules under
Windows ?
Thanks
Aurelien
------------------------------
Date: 4 May 2000 07:43:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how do I catch user's input?
Message-Id: <8er66q$hga$1@orpheus.gellyfish.com>
On Wed, 03 May 2000 16:29:27 GMT bing-du@tamu.edu wrote:
> Greetings...
>
> Here is a newbie question. If I want to make an interactive perl to
> prompt user questions for answers, such as:
>
> # test.pl
> what's your name: <user's input>
> what's your major: <user's input>
> ...
>
> How should I refer those user's input in my script? Are there any
> standard names for those variables? Basically, I want to collect
> anwsers in a hash like this:
>
> $user{$name} = <user's answer>
> $user{$major} = <user's answer>
>
> Your help would be greatly appreciated.
>
<STDIN>
As discussed in all the best Perl manuals ...
/J\
--
Marge, there's an empty spot I've always had inside me. I tried to fill
it with family, religion, community service, but those were dead ends! I
think this chair is the answer.
--
fortune oscar homer
------------------------------
Date: Thu, 04 May 2000 17:02:23 +0800
From: Dayang Lily <r19610@email.sps.mot.com>
Subject: How to find a matching ")"?
Message-Id: <39113C9F.DB75C04F@email.sps.mot.com>
Hi,
I have a script that reads a file, finds some matching words in that
file and put the entire line that contains the matched word into an
variable. For example :
my_file :
(value name linda mary)
(value class A B C)
(value title "Note").
My script works something like this:
while(<my_file>) {
if(/value name/)
{ $thename = $_}
if(/value title)
{ $thetitle = $_
&dosomething($thename,$thetitle)}
}
The problem occurs when I have more than one line in the list, eg
(value name linda mary
jane peter
joan ross
)
How do I read this entire list into my variable? How do I find a
matching ")"?
Thanks in advance.
--
Best Regards,
Dayang Lily
=======================================================
Test & Systems Engineer
NPI & Test Engineering Department
Motorola Malaysia Sdn Bhd
Email : Dayang.Lily@motorola.com
=======================================================
------------------------------
Date: 4 May 2000 07:49:27 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: http:request et Firewall
Message-Id: <8er6hn$ij0$1@orpheus.gellyfish.com>
In comp.lang.perl.misc Nicolas Suteau <suteau@site-eerie.ema.fr> wrote:
> Bonjour,
>
> j'utilise le petit programme suivant sur Pc sous windows. Tout
> fonctionne lorsque j'utilise ma machine perso et un provider normal.
>
> A mon bureau, je dois avant de me connecter utiliser socksCap32. Mais je
> ne sais pas faire fonctionner perl avec ce programme. Perl ne peut plus
> se connecter à internet. Pouvez-vous m'aider ? (peut-on configurer le
> port de sortie ?)
>
> Nico.
>
> #!c:/perl/bin/perl -w
> print "Content-type: text/html\n\n";
>
> use CGI;
> require LWP::UserAgent;
> $ua = new LWP::UserAgent;
>
> $url = "http://www.clubsoleil.net/";
>
> ### se connecter à la page web distante ###
> $lookup = new HTTP::Request 'GET', $url ;
> $reponse = $ua->request($lookup);
> @lignes = split (/\n/, $reponse->content);
> $page = join ("", @lignes);
>
>
> print ("$page");
> exit;
>
I would imagine that you will need to use some proxy to do this via a
firewall. You should set the HTTP_PROXY environment variable.
/J\
--
Well, crying isn't gonna bring him back...unless your tears smell like
dog food. So you can either sit there crying and eating can after can
of dog food until your tears smell enough like dog food to make your
dog come back or you can go out there and find your dog.
--
fortune oscar homer
------------------------------
Date: Thu, 4 May 2000 20:01:27 +1200
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: if file already exists then remove...
Message-Id: <957427283.510887@shelley.paradise.net.nz>
"Henry" <htp@mac.com> wrote in message
news:htp-C5E28A.02015304052000@news.metropolis.net.au...
> In article <39100F98.BDA249D2@bmjgroup.com>, Kourosh A Mojar
> <kmojar@bmjgroup.com> wrote:
>
> > Im inexperienced programmer so please forgive me. I simply want to
> > remove a file if it already exists. i.e. if test.txt already exists in
> > folder then remove. Here is what I have done so far
> >
> > $output = "test\.txt";
> >
> > if ($output exists) {
> > # unlink($output) || die "could not delete $output";
> > }
> >
> > Any help will be appreciated. Thanking you in advance and for your kind
> > attention,
>
> Err... Why bother testing for it's existence at all? Why not simply:
>
> unlink($output);
>
> If the file exists, it will get deleted. If the file doesn't exist,
> unlink will fail, but provided you don't try and catch the error, your
> program will keep running.
>
> The usual caveats about unlink and file permissions apply.
This could lead to a security problem. If someone creates link to file (say
a password file) and you just try to delete the file, BING there goes your
precious password file (depending on permissions of course).
Much nicer to test for a file type:
eg:
unlink($file) if -f $file;
------------------------------
Date: 4 May 2000 08:50:49 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: if file already exists then remove...
Message-Id: <slrn8h2ef9.s8f.vek@pharmnl.ohout.pharmapartners.nl>
On Wed, 03 May 2000 18:45:41 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
>
>But actually, unlink doesn't mind a failure, so simply drop the test.
>
> unlink $filename;
>
Unless you need to know if the unlink failed for reasons other than the
filename did not exists.
Villy
------------------------------
Date: 4 May 2000 07:39:41 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Installing modules with CPAN
Message-Id: <8er5vd$gof$1@orpheus.gellyfish.com>
On Wed, 03 May 2000 15:17:46 GMT rscrane@my-deja.com wrote:
> On an SGI with perl and gcc installed in /usr/freeware, the make called
> from a CPAN install tries to use "cc" -- how can I get it to use gcc?
>
> tried exporting CC=gcc, and looked through ~/.cpan/CPAN/MyConfig.pm but
> couldn't find anywhere to set it.
>
It is in another Config file :
/usr/lib/perl5/5.6.0/i686-linux/Config.pm
on my system.
However you might also consider linking gcc to cc somewhere in your path
before your system's cc ..
/J\
--
Marge, I'm going to miss you so much. And it's not just the sex. It's
also the food preparation.
--
fortune oscar homer
------------------------------
Date: 4 May 2000 07:36:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Killing a query with DBI/DBD
Message-Id: <8er5on$g3f$1@orpheus.gellyfish.com>
On Wed, 03 May 2000 14:57:10 GMT Jeffrey P. Medeiros wrote:
> Is there an API call to kill a query with DBI/DBD? I would like to kill a
> query in the case of mistyped information or an unusually long query.
>
> I'm using the Informix DBD.
>
onmode -z <session id> on your database server (Or just kill the sqlexec
if you are using SE).
/J\
--
It's like something out of that twilighty show about that zone.
--
fortune oscar homer
------------------------------
Date: 4 May 2000 08:05:56 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: migrate modules to perl5.6.0
Message-Id: <8er7gk$lmt$1@orpheus.gellyfish.com>
On 3 May 2000 17:08:41 GMT Danny Aldham wrote:
> X-Newsreader: TIN [version 1.2 PL2]
>
I'd fix that ;-}
>
>
> I have just upgraded to perl5.6.0 . Maybe it was wishful thinking, but
> I thought this version was going to allow me to upgrade perl without
> having to reinstall all my CPAN modules. How can I get a list of modules
> installed on my old perl suitable for feeding to the CPAN module to
> reinstall for me?
>
perldoc perllocal will give you a list of installed modules. However you
might be better off doing :
perl -MCPAN -eautobundle
Which will create a Bundle::* module that will cause all of the existing
modules to be reinstalled.
Infact if you answered appropriately in Configure you *should* still be
able to use your 5.005 modules.
/J\
--
When I look at the smiles on all the children's faces,,...I just know
they're about to jab me with something.
--
fortune oscar homer
------------------------------
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 2944
**************************************