develooper Front page | perl.perl5.porters | Postings from November 2003

Re: $^E bug and perl 5.8.0

Thread Previous | Thread Next
From:
Chris Nandor
Date:
November 19, 2003 08:09
Subject:
Re: $^E bug and perl 5.8.0
Message ID:
p06010206bbe14445af66@[10.0.1.177]
At 16:50 +0100 2003.11.19, Rafael Garcia-Suarez wrote:
>Chris Nandor wrote:
>>
>> At 16:39 +0100 2003.11.19, Rafael Garcia-Suarez wrote:
>> >What does
>> >	perl -le 'print $!=22'
>> >on your system ?
>>
>> 22.
>
>Hmm, weird -- on my Linux 2.2 it prints correctly "Invalid argument".
>I wanted to know what was this errno corresponding to.

Ah.

[pudge@bourque pudge]$ perl -le 'print $!=22'
Invalid argument


>Try this naive patch :
>
>--- mg.c.orig	Wed Nov 19 16:41:47 2003
>+++ mg.c	Wed Nov 19 16:44:14 2003
>@@ -623,8 +623,12 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
> 		  SetLastError(dwErr);
> 	     }
> #else
>-	     sv_setnv(sv, (NV)errno);
>-	     sv_setpv(sv, errno ? Strerror(errno) : "");
>+	     {
>+		 int saveerrno = errno;
>+		 sv_setnv(sv, (NV)errno);
>+		 sv_setpv(sv, errno ? Strerror(errno) : "");
>+		 errno = saveerrno;
>+	     }
> #endif
> #endif
> #endif

Heh, when I do that, I get:

$ perl -le '$^E=-1728; print $^E+0 for 0,1'
22
22

So I don't even get the correct value the *first* time.  :)

-- 
Chris Nandor                      pudge@pobox.com    http://pudge.net/
Open Source Development Network    pudge@osdn.com     http://osdn.com/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About