[22046] in Perl-Users-Digest
Perl-Users Digest, Issue: 4268 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 16 06:05:38 2002
Date: Mon, 16 Dec 2002 03:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 16 Dec 2002 Volume: 10 Number: 4268
Today's topics:
.cgi script error :( (Artem)
Re: .cgi script error :( <jurgenex@hotmail.com>
Re: chained maps and greps <goldbb2@earthlink.net>
Re: copy, rename, open - more confusion? <goldbb2@earthlink.net>
Re: Debugger parses differently? (Anno Siegel)
editing files <richard.cross@NOPSPAM.freeserve.com>
Freing Unused Memory in Perl <spp@monaco377.com>
Re: Getting the week day from a previous date. (Tad McClellan)
Re: hash efficiency and key/value/array reading file (qanda)
Re: matching words starting and ending with defined let (liglin)
Re: Need help with Script <autochem@worldnet.att.net>
Re: Odd pack() behavior <goldbb2@earthlink.net>
Perl Developer Journal? <extendedpartition@NOSPAM.yahoo.com>
Re: Perl Developer Journal? (Sam Holden)
Re: Perl Developer Journal? <extendedpartition@NOSPAM.yahoo.com>
Piping HTML tags (total newbie question) <ashfaaq.usman@bt.com>
Re: reg exp problem <goldbb2@earthlink.net>
RESIZE IMAGES PERL MODULES? <fede72bari@tiscali.it>
Re: RESIZE IMAGES PERL MODULES? <dave@dave.org.uk>
sendmail option <cwg@attbi.com>
Re: sendmail option <goldbb2@earthlink.net>
Re: sendmail option <mgjv@tradingpost.com.au>
Re: sendmail option <dave@dave.org.uk>
Re: Suffering from Buffering - Help <goldbb2@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Dec 2002 19:08:35 -0800
From: dij@inbox.ru (Artem)
Subject: .cgi script error :(
Message-Id: <4e8dc406.0212151908.3cfafc58@posting.google.com>
Hi
I am having problem with my ezFormMailer script.
When I press submit button i get this error:
Error! The HTTP_REFERER "http://mywebstep.com/contactus.html" does not have
permission to use this script.
Here is the url for the .html
------------------------------
Date: Mon, 16 Dec 2002 04:25:17 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: .cgi script error :(
Message-Id: <NAcL9.21252$_S2.13846@nwrddc01.gnilink.net>
Artem wrote:
> When I press submit button i get this error:
> Error! The HTTP_REFERER "http://mywebstep.com/contactus.html" does
> not have permission to use this script.
This is not a Perl error message.
You may want to check the documentation of your web server or ask in a NG
that is dedicated to your web server or CGI programming in general.
jue
------------------------------
Date: Mon, 16 Dec 2002 01:07:31 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: chained maps and greps
Message-Id: <3DFD6DA3.1612BF1E@earthlink.net>
foobear@nospam.doom.net wrote:
>
> Hello folks
>
> Somewhat of a perl golf question, I'm not trying to obfuscate my code,
> just want to understand chained maps or greps.
>
> I was wondering how I could turn this block of code in to a one liner.
>
> if (@ids) {
> my @sessions;
> for my $ses ($self->sessions) {
> for (@ids) {
> push @sessions, $ses if $ses->id eq $_;
> }
> }
> return @sessions;
> }
if( @ids ) {
my %ids = map {; $_, 1 } @ids;
return grep $ids{$_->id}, $self->sessions;
}
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Mon, 16 Dec 2002 00:38:54 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: copy, rename, open - more confusion?
Message-Id: <3DFD66EE.55770FC5@earthlink.net>
Tad McClellan wrote:
[snip]
> untested:
>
> # open A, B and D filehandles before here
> { local $^I = '.old';
> local @ARGV = 'file.original';
Add:
my %type2handle = (a => *A, b => *B, c => *C);
> while ( <> ) {
> my $type = determine_type($_);
>
> if ( $type eq 'a' )
> { print A }
> elsif ( $type eq 'b' )
> { print B }
> elsif ( $type eq 'd' )
> { print D }
> else
> { print }
Replace all that with:
print { $type2handle{determine_type($_)} or *STDOUT };
> }
> unlink 'file.original.old'; # don't really want a backup file
> }
[changes are untested]
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: 16 Dec 2002 10:25:03 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Debugger parses differently?
Message-Id: <atk9lv$cbu$1@mamenchi.zrz.TU-Berlin.DE>
According to Jeff Boes <jboes@qtm.net>:
> Here's a puzzle: this code --
>
> 1 && $a = 1;
The variable "$a" is best avoided in Perl, it is a system variable used
by sort() and may behave in unexpected ways. (The same goes for "$b").
This doesn't cause your problem, however.
> is perfectly acceptable Perl, and parses in perl with or without the '-d' flag.
>
> However, this code --
>
> use constant DEBUG => 1;
> DEBUG && $a = 1;
>
> parses without '-d', but not with '-d':
>
> Can't modify logical and (&&) in scalar assignment at testdbg.pl line 5, near
> "1;"
I cannot reproduce the problem you describe under Perl 5.8.0 -- the code
behaves the same for me under the debugger and without. What Perl version
are you using?
> You have to add parentheses to get it through the debugger:
>
> DEBUG && ($a = 1);
These parentheses are a good idea anyway. Since "&&" binds tighter than
"=" in Perl, the original statement is parsed as "(DEBUG && $a) = 1".
If "DEBUG" is true, the result of the left hand side is "$a", which
can be assigned to. However, if DEBUG is false, the left hand side
evaluates to "DEBUG", and the assignment fails with the message you
have quoted.
So use the parentheses, or use the "and" variant of "&&" which has
lower priority: "DEBUG and $a = 1".
Anno
------------------------------
Date: 16 Dec 2002 08:53:23 GMT
From: Richard Cross <richard.cross@NOPSPAM.freeserve.com>
Subject: editing files
Message-Id: <Xns92E65A90979B0richardcrossfreeserv@195.92.193.157>
I dusted off my old copy of "Star Wars: Dark Forces" for the PC last night
and was disappointed that there was no way to re-map the keys to a more
modern convention. However, I found out via the net
(http://db.gamefaqs.com/computer/doswin/file/star_wars_dark_forces.txt)
that one of the binary config files (jedi.cfg) can be edited in a hex
editor (I used UltraEdit), if you replace the bytes at certain offset
values with the desired keyboard codes (http://panda.cs.ndsu.nodak.edu/
~achapwes/PICmicro/keyboard/scancodes1.html).
It works, but it's a somewhat
Now I want to write something in Perl to make this easier for anyone else
to accomplish. Is there an easy way of being able to read a file in Perl
such that each line is exactly 16 bytes long and can easily be separated
into bytes' hex values. I also need each line of the file to be number in
hex too.
Hope someone knows what I'm talking about. Basically I guess I'm trying to
write a simple hex editor in Perl.
Thanks,
Rick.
------------------------------
Date: Mon, 16 Dec 2002 11:16:43 +0100
From: =?ISO-8859-15?Q?S=E9bastien?= Cottalorda <spp@monaco377.com>
Subject: Freing Unused Memory in Perl
Message-Id: <3dfda8ab$0$11833$626a54ce@news.free.fr>
I all,
Here is my configuration.
(Perl 5.6.0 on Linux RedHat 2.4.18-3)
I've a perl program that contains, during a certain time, some records in a
%HASH table (size about 7 Mo).
Then, when the user has finished to work with, the program delete the hash
table with %HASH=();
The problem:
- At the begining of the perl program (the %HASH is created but not
used=empty), the size reserved by the OS for the perl program represent
some ko.
- When the %HASH table is used (with all records), the memory reserved grows
up to 7Mo.
- During all the life of the perl program, the Memory size reserved by the
OS for the program is still about 7Mo even if the %HASH table is deleted.
Is there a way to free the OS reserved memory, I've some old PC that are
able to use temporarily 7Mo for that program, but I would not like the perl
program to use 7Mo of RAM (64Mo on the PC) during its entire life.
If somebody as a clue?
Thanks in advance.
Sébastien
------------------------------
Date: Sun, 15 Dec 2002 20:19:11 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Getting the week day from a previous date.
Message-Id: <slrnavqe0v.cog.tadmc@magna.augustmail.com>
rob.buxton@wcc.spam.govt.nz <rob.buxton@wcc.spam.govt.nz> wrote:
> I'm trying to determine what the weekday is from a given date.
use Date::Calc qw/ Day_of_Week /;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Dec 2002 02:52:58 -0800
From: fumail@freeuk.com (qanda)
Subject: Re: hash efficiency and key/value/array reading file
Message-Id: <62b4710f.0212160252.296900b8@posting.google.com>
Thanks for the help, I've now ended up with this ...
#!/usr/bin/perl -w
#use diagnostics -verbose;
use warnings;
use strict;
get_config() or die "Mandatory config values missing!\n";
print "Continue ...\n";
sub get_config {
my $frc = 0; # Function return code, default to fail.
my %config_keys; # Keys required.
my %config_values; # Values of keys.
@config_keys{ qw(
KEY2
KEY5
)} = ();
# Load keys required.
while( <DATA> ) {
chomp;
# Remove blank lines and comments.
s/\s+|#.*$//g;
# Only keep keys with values.
if (/(\S+)=(\S+)/) {
next if ! exists $config_keys{ $1 };
$config_values{ $1 } = $2;
}
$frc = 1; # Set to success here?
}
# HELP - Want to wrap this test into above loop.
foreach my $key( keys %config_keys ) {
if( ! exists $config_values{$key} ) {
print "$key not found!\n";
$frc = 0;
}
}
return $frc;
}
__DATA__
# normal comment
# comment with spaces
KEY1 = key1_value
# random comment
KEY6
KEY3 # comment on key/value line, no value
KEY2 = # key2_value # comment on key/value line with value
# Blank line
KEY5 = key5_value
# Blank line with spaces/tabs
KEY4 =
This is fine for the data given however very inefficient with a large
data set. It there a way I can check in the loop that the requied
keys have a value?
I'm still learning (very slowly), so please point out anything bad or
C-like (non-perlistic!) you notice above.
One point, in C I always use function return codes (plus a global
error code) and set to fail by default to force success in the code.
Thanks.
------------------------------
Date: 15 Dec 2002 18:33:33 -0800
From: liglinlillibli@hotmail.com (liglin)
Subject: Re: matching words starting and ending with defined letters
Message-Id: <db9bdb31.0212151833.6d35fa74@posting.google.com>
Thanks Juergen, for pointing out the wider scope related to the
question. And thanks for pointing me to
http://www.perldoc.com/perl5.6.1/pod/perlre.html
Liglin
------------------------------
Date: Mon, 16 Dec 2002 06:54:46 GMT
From: "Way of the Kali" <autochem@worldnet.att.net>
Subject: Re: Need help with Script
Message-Id: <WMeL9.55613$vM1.4453889@bgtnsc04-news.ops.worldnet.att.net>
Yah, Im not actually a perl programmer, I got the script from this website
for a website voting booth but couldnt get it to work.
I followed the instructions that came with it but am getting that error.
Anyways, thanks for the responses.
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnavp56v.aae.tadmc@magna.augustmail.com...
> Way of the Kali <autochem@worldnet.att.net> wrote:
>
> > Can somebody help me determine what was causing that error message?
>
>
> No.
>
> Format your code sensibly if you expect sensible people to look at it.
>
>
> > flock(VOTES,8); close(VOTES);
>
> You are not implementing file locking correctly.
>
> Lose the flock() call there.
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Sun, 15 Dec 2002 23:44:07 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Odd pack() behavior
Message-Id: <3DFD5A17.53ADE27E@earthlink.net>
Brian C. Lane wrote:
>
> In article <fplovu0r2u1b3ia5gtt8jl6fale1g2fofe@4ax.com>, Bart Lateur wrote:
> > Brian C. Lane wrote:
> >
> >>I've run into a strange problem with pack. It seems to be outputting a
> >>single byte for 'H2' on one machine, which is the correct behavior. But on
> >>another maching I'm getting 2 bytes, and they aren't what they are supposed
> >>to be.
> >
> > Hmm... Some automatic stealthed conversion to UTF-8? Are the bytes
> > "\xC3\xBF"?
>
> Bingo! That's what hexdump shows on the resulting file. Any idea why
> this is happening? And how to fix it?
Are you on Red Hat Linux? The newer releases set the LANG environment
variable to *claim* that *everything* on the system designed for dealing
with text files expect UTF8 encoding -- perl sees this, and in response,
makes any filehandle which you haven't marked as non-text utf8-encoded.
The solution is to use binmode() on all filehandles which contain binary
data.
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Mon, 16 Dec 2002 00:54:00 -0600
From: "Extended Partition" <extendedpartition@NOSPAM.yahoo.com>
Subject: Perl Developer Journal?
Message-Id: <3dfd7877_1@nntp2.nac.net>
Hello Everyone,
Can anyone tell me where I can find the Perl Developers Journal online? I've
searched for it at GOOGLE.COM and found nothing. Anyone have the URL?
Thanks!
--
Anthony Saffer [Founder and CEO]
Saffer Consulting Services
www.safferconsulting.com
Discount Webhosting Available
SUPPORT ICQ: 17720817
PERSONAL ICQ: 96698595
------------------------------
Date: 16 Dec 2002 07:06:18 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Developer Journal?
Message-Id: <slrnavqura.eqt.sholden@flexal.cs.usyd.edu.au>
On Mon, 16 Dec 2002 00:54:00 -0600,
Extended Partition <extendedpartition@NOSPAM.yahoo.com> wrote:
> Hello Everyone,
>
> Can anyone tell me where I can find the Perl Developers Journal online? I've
> searched for it at GOOGLE.COM and found nothing. Anyone have the URL?
Never heard of it, there's the perl journal at http://www.tpj.com/ ???
--
Sam Holden
------------------------------
Date: Mon, 16 Dec 2002 02:47:10 -0600
From: "Extended Partition" <extendedpartition@NOSPAM.yahoo.com>
Subject: Re: Perl Developer Journal?
Message-Id: <3dfd9302_2@nntp2.nac.net>
"Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
news:slrnavqura.eqt.sholden@flexal.cs.usyd.edu.au...
> On Mon, 16 Dec 2002 00:54:00 -0600,
> Extended Partition <extendedpartition@NOSPAM.yahoo.com> wrote:
> > Hello Everyone,
> >
> > Can anyone tell me where I can find the Perl Developers Journal online?
I've
> > searched for it at GOOGLE.COM and found nothing. Anyone have the URL?
>
> Never heard of it, there's the perl journal at http://www.tpj.com/ ???
Thanks Sam. That's what I was looking for!
Anthony Saffer
------------------------------
Date: Mon, 16 Dec 2002 10:58:55 +0000
From: Ashfaaq Usman <ashfaaq.usman@bt.com>
Subject: Piping HTML tags (total newbie question)
Message-Id: <3DFDB1EF.136FBB4C@bt.com>
Hi,
I am a total newbie and would appreciate any help with the following
problem:
What I want to do is run a function of some sort in Perl which I can
provide a URL to, which will then suck the HTML tags from the requested
URL and pipe this out to a text file on the client machine.
Any idea how to do this....?
Thanks
Ash
------------------------------
Date: Mon, 16 Dec 2002 00:45:36 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: reg exp problem
Message-Id: <3DFD6880.DBEB6B45@earthlink.net>
jaya prakash wrote:
[snip]
> > Your pattern was:
> >
> > m/(.{1,3})\1{7,}/
>
> to eliminate greediness i have modified the pattern matching
> expression to the following.
>
> m/(.)\1{7,}|(..)\2{7,}|(...)\3{7,}/
To eliminate greediness, use the ? modifyer:
m/(.{1,3}?)\1{7,}/
Or:
m/((.{1,3}?)\2{7,})/
This will do the same as your pattern, with the benefit of being
shorter, and being able to use $1, instead of having to use $&.
PS: If you want to find *all* such patterns of repeats, try:
print $1, "\n" while $str =~ m/(?=((.{1,3}?)\2{7,}))/g;
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Mon, 16 Dec 2002 08:43:48 +0100
From: "Federico Bari" <fede72bari@tiscali.it>
Subject: RESIZE IMAGES PERL MODULES?
Message-Id: <atk098$q53$1@lacerta.tiscalinet.it>
Hi All,
do somebody know if perl modules for resizing images exist??? Thank you
very much,
Federico.
------------------------------
Date: Mon, 16 Dec 2002 07:52:09 +0000
From: "Dave Cross" <dave@dave.org.uk>
Subject: Re: RESIZE IMAGES PERL MODULES?
Message-Id: <pan.2002.12.16.07.52.09.727157@dave.org.uk>
On Mon, 16 Dec 2002 08:43:48 +0100, Federico Bari wrote:
> Hi All,
>
> do somebody know if perl modules for resizing images exist??? Thank you
> very much,
Perl has modules that interface to both GD and ImageMagick. You'll find
them at CPAN <http://search.cpan.org/>.
Dave...
--
And crawling on the planet's face, some insects called the human race
Lost in time, and lost in space. And meaning.
------------------------------
Date: Mon, 16 Dec 2002 03:11:42 GMT
From: "Levidikus Alatyam" <cwg@attbi.com>
Subject: sendmail option
Message-Id: <OvbL9.364022$%m4.118278@rwcrnsc52.ops.asp.att.net>
I am using a form online and I want it to send me an email each time to form
is submited.....
I know how to do this for unix but what about windows based OS's?
$mailprog = "/usr/lib/sendmail"
or does this work on windows OS also?
Lev.
------------------------------
Date: Sun, 15 Dec 2002 23:50:24 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: sendmail option
Message-Id: <3DFD5B90.7BDB1F@earthlink.net>
Levidikus Alatyam wrote:
>
> I am using a form online and I want it to send me an email each time
> to form is submited..... I know how to do this for unix but what about
> windows based OS's?
>
> $mailprog = "/usr/lib/sendmail"
>
> or does this work on windows OS also?
On windows, you need to download and install blat.exe
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: Mon, 16 Dec 2002 05:18:24 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: sendmail option
Message-Id: <slrnavqokj.865.mgjv@verbruggen.comdyn.com.au>
On Mon, 16 Dec 2002 03:11:42 GMT,
Levidikus Alatyam <cwg@attbi.com> wrote:
> I am using a form online and I want it to send me an email each time to form
> is submited.....
> I know how to do this for unix but what about windows based OS's?
>
> $mailprog = "/usr/lib/sendmail"
>
> or does this work on windows OS also?
Only if you have an external mail program. I believe that for windows
there is something called blat.
Alternatively, you use Mail::Internet, or Mail::Mailer directly, which
can talk to your SMTP server. Also see the Perl FAQ, section 9,
Question "How do I send mail?". Read to the end of the answer. Then go
to search.cpan.org, and find the documentation of Mail::Internet and
Mail::Mailer. Both are part of the same bundle of modules (MailTools).
Martien
--
|
Martien Verbruggen | This matter is best disposed of from a great
Trading Post Australia | height, over water.
|
------------------------------
Date: Mon, 16 Dec 2002 06:40:55 +0000
From: "Dave Cross" <dave@dave.org.uk>
Subject: Re: sendmail option
Message-Id: <pan.2002.12.16.06.40.54.837418@dave.org.uk>
On Mon, 16 Dec 2002 03:11:42 +0000, Levidikus Alatyam wrote:
> I am using a form online and I want it to send me an email each time to form
> is submited.....
> I know how to do this for unix but what about windows based OS's?
>
> $mailprog = "/usr/lib/sendmail"
>
> or does this work on windows OS also?
You can try the nms_sendmail program - which implements a subset of
sendmail functionality in pure Perl and therefore runs on any platform.
<http://nms-cgi.sourceforge.net/>
hth,
Dave...
--
Two slightly distorted guitars
------------------------------
Date: Mon, 16 Dec 2002 01:04:11 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Suffering from Buffering - Help
Message-Id: <3DFD6CDB.1B99F4E3@earthlink.net>
Sunil wrote:
>
> ---------------------------------------------------
> open(ERRLOG, ">$errorLog") or die "Can't open error log! $!";
> $OUTPUT_AUTOFLUSH = 1; # make unbuffered
This makes STDOUT unbuffered, it does not effect ERRLOG.
I think you wanted either:
ERRLOG->autoflush(1);
Or:
$| = 1, select $_ for select ERRLOG;
> open(OUTPUT, ">>$logFile") or die "Can't open output log! $!";
> OUTPUT->autoflush(1);
>
> my $pid;
Here you declare $pid. Good!
> eval
> {
> my $pid = open3("<&STDIN", ">&OUTPUT", ">&ERRLOG", $command) or die "$!";
Here you *re*declare $pid. Bad! This masks the outer $pid variable,
and when it goes out of scope, you no longer know the process ID of the
started program.
I believe that I should also mention that turning autoflush on or off
has NO EFFECT WHATSOEVER when passing a handle to open3 via ">&NAME",
since the started $command will only recieve the underlying
filedescriptor, not the entire filehandle (which may contain buffers,
filters, and other perlio layers).
> };
> die $@ if $@;
If you're going to die if an error occured, why bother to trap the error
in the first place? Leave out both the eval{} around the open3, and
leave out the die $@ if $@, and your code will be easier to read, and
work just the same.
> waitpid ($pid, 0); # wait for it to die
You should check whether waitpid has succeeded.
More importantly, you should check what's in $?.
> close(ERRLOG) or die "Can't close filehandle! $!";
> close(OUTPUT) or die "Can't close filehandle! $!";
The only kind of error that you're likely to get on an ordinary
filehandle is one from being out of disk space -- I'm not saying to
remove this error checking here, but I usually wouldn't don't bother to
put it in on this type of handle.
> ### This check never works ###########################
> if (-s "$errorLog")
> { }
It hardly matters if the check succeeds or not if you don't do anything
with it.
> if (open(RESULTS_FILE, "$logFile"))
> {
> while (<RESULTS_FILE>)
> {
> print ;
> ### Does not print anything :-( ########################
Presumably, that's because the file is empty.
> }
> close(RESULTS_FILE);
> }
> ---------------------------------------------------
>
> Anything to lessen my misery?
You don't know whether or not $command completed successfully because
you didn't check $?.
--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 4268
***************************************