On 3/27/2004 10:12 PM, John W. Krahn wrote:
"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:

I regret to inform you that you are correct :-/


perl -MDevel::Peek -e '$e=$!=2;print Dump($!)'

SV = PVMG(0x1c1bc58) at 0x1aaeb94
  REFCNT = 1
  FLAGS = (GMG,SMG,pNOK,pPOK)
  IV = 2
  NV = 2
  PV = 0x1aa0128 "No such file or directory"\0
  CUR = 25
  LEN = 26
  MAGIC = 0x1abb470
    MG_VIRTUAL = &PL_vtbl_sv
    MG_TYPE = '\0'
    MG_OBJ = 0x1aaeba0
    MG_LEN = 1
    MG_PTR = 0x1aa014c "!"

I don't know where I got it from that strerror was called in an overriden stringization method, but I would have sworn to it until I saw your message. In fact, I /still/ believe it to be true... just in some other context: maybe a different variable? maybe it was ruby instead of perl? I *know* I got that from somewhere...

Oh, well. Thanks for the correction John.

BTW, anyone know why Devel::Peek won't print the correct data unless the variable is first used in an expression? (i.e. the above one-liner won't work if you take out the '$e=' part of the expression.

Regards,
Randy.


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