[perl] sysopen(CD, "/dev/cd0", O_RDONLY | O_NONBLOCK) fails
Tobias Rehbein
tobias.rehbein at web.de
Fri Mar 27 13:30:21 PDT 2009
Am Fri, Mar 27, 2009 at 09:19:53PM +0100 schrieb Joost Bekkers:
> On Fri, March 27, 2009 19:59, Tobias Rehbein wrote:
> > Am Thu, Mar 26, 2009 at 10:11:28PM +0000 schrieb Bruce Cran:
> >>
> > Hm. Tried this and got ineresting results:
> >
> >> use POSIX;
> >> sysopen(CD,"/dev/cd0", O_RDONLY|O_NONBLOCK) || perror("sysopen")
> > works fine, but
> >> use POSIX;
> >> sysopen(CD,"/dev/cd0", O_RDONLY|O_NONBLOCK)
> >> print "$!"
> > prints "No such file or directory"
> >
> > Well, I think I'll have to accept that sysopen works but $! does not...
> > After
> > all sysopen is more important to me ;)
>
> As the perlvar manpage tells us:
>
> $! If used numerically, yields the current value of the C "errno"
> variable, or in other words, if a system or library call fails,
> it sets this variable. This means that the value of $! is
> meaningful only immediately after a failure.
>
> The value of $! is NOT an indicator of success or failure. It only tells
> you why something failed. If something succeeded $! is usualy left
> untouched.
Yes, that sounds sensible. Thanks for clarification.
--
Tobias Rehbein
PGP key: 4F2AE314
server: keys.gnupg.net
fingerprint: ECDA F300 1B6E 9B87 8524 8663 E8B6 3138 4F2A E314
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090327/d24cfce3/attachment.pgp
More information about the freebsd-questions
mailing list