"Randy W. Sims" wrote:
> 
> James Edward Gray II wrote:
> 
> > Fact:  This has nothing to do with ANY variables, it is the way warn()
> > is designed.
> 
> Trivia:
> 
> Did you know that $! does NOT contain an error string. It contains the
> error *number*. The only reason you see a error sting is that it has an
> overloaded stringification operator that calls strerror() on the numeric
> value that it contains.

Did you know that $! is one of those "magical" variables that contains
both a number and a string at the same time!  AMAZING BUT TRUE!  Here is
an exerpt from the perl source:

    case '!':
#ifdef VMS
    sv_setnv(sv, (NV)((errno == EVMSERR) ? vaxc$errno : errno));
    sv_setpv(sv, errno ? Strerror(errno) : "");
#else
    {
    int saveerrno = errno;
    sv_setnv(sv, (NV)errno);
#ifdef OS2
    if (errno == errno_isOS2 || errno == errno_isOS2_set)
        sv_setpv(sv, os2error(Perl_rc));
    else
#endif
    sv_setpv(sv, errno ? Strerror(errno) : "");
    errno = saveerrno;
    }
#endif
    SvNOK_on(sv);   /* what a wonderful hack! */
    break;


Where you can see that sv_setpv() sets the string part of $! and
sv_setnv() sets the numeric part.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to