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.)


.



Relevant Pages

  • Advice for moving linux script to MacPerl
    ... in perl that runs on our Linux web server. ... - I told them to download and install MacPerl, ... script that prints the environment variables. ...
    (comp.lang.perl.misc)
  • Perl / Apache on RH9.0 not working.
    ... The server encountered an internal error and was unable to complete your ... Premature end of script headers: ... This is the first time I"ve used Apache 2.0 so I'm not sure if this is an Apache or a Perl issue. ... Configuration Phase Participation: Create Directory Config, ...
    (RedHat)
  • Re: DBD::Oracle dbd_st_execute slow speed
    ... I take it you are comparing like for like with the Plus or Developer script? ... have you tried this piece of Perl with some hardcoded values? ... My DBA ran an analyze table, looked at the indexes and server ... the same oracle database and same schema and tables. ...
    (perl.dbi.users)
  • [Full-Disclosure] PR0V1NG RFP WR0NG
    ... Agree that the presented Perl code has issues, and I agree that it's very ... I've taken a sample perl test script which reads: ... Server: Netscape-Enterprise/4.1 ... I'm a washed out sell out capitalizing on my 10 seconds of fame for writing some crappy advisories and some shitty perl code. ...
    (Full-Disclosure)
  • RE: Perl / Apache on RH9.0 not working.
    ... Perl / Apache on RH9.0 not working. ... The server encountered an internal error and was unable to complete your ... Premature end of script headers: ... Configuration Phase Participation: Create Directory Config, ...
    (RedHat)