Re: quotes difference in Perl5.6 vs 5.8



Ben Morrow wrote:
Quoth "Petr Vileta" <stoupa@xxxxxxxxxxxxx>:
#!/usr/bin/perl
use strict;
use warnings;
my $var = "abcd'efg";
open OUT, "> log.txt" or die("You stupid!");
print OUT "$var\n";
close OUT;

This work in Perl 5.6.1 but fail in 5.8.0, but if I change this

Don't use 5.8.0. It is very buggy. You should upgrade to 5.8.1 if at
all possible.

Thank you for confirmation of my suspicion :-) I never installed Perl 5.8.0 but admin on some hosting server do it ;-( I wrote scripts for Perl 5.6.1 and these run fine on many hosting servers on different Perl's. I never see as many troubles as on this hosting.

print OUT "$var\n";
to this
print OUT $var, "\n";
then this work in both Perl versions.

I *seriously* doubt this makes any difference... I think it's more
My thinks are the same. This must be the same if Perl is not buggy, or server not fail randomly.
[...]
What is STDERR open to?
I don't know ;-) Maybe is redirected somewhere to user error-log file, to some parser script, really don't know.
I not redirect STDERR anywhere in my script except in SIGPIPE handler.

What happens if you set $SIG{PIPE} to 'IGNORE' and check the return
value of all your print statements?
This is impossible. I grab html code from web pages, parse it and store to database. If I ignore SIGPIPE then I can store wrong data to database. I must be sure that data are OK or exit from script.

What happens if, instead of this, you install your SIGPIPE handler
with POSIX::sigaction, which will bypass safe signals; something like

I did not know this, I will take a look to it. I'm trying to not use POSIX, because many functions are not multiplatform and my scripts are running on Linux and Windows servers too.

Thanks for your tips.
--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail from another non-spammer site please.)


.