in reply to Re^2: Different behaviour of 'stat' function after assignment to $! (errno).
in thread Different behaviour of 'stat' function after assignment to $! (errno).

pNOK is now set, but the value hasn't been updated by stat itself. It's only when $! is referenced that the updated value materializes.

Correct. It's set by SvGETMAGIC, which is called when the value of a magic SV is needed. The state of pNOK and the like should be completely ignored by -$! since negation should call SvGETMAGIC, but negation isn't calling SvGETMAGIC in the OP's version of Perl.

  • Comment on Re^3: Different behaviour of 'stat' function after assignment to $! (errno).
  • Download Code