http://qs321.pair.com?node_id=317128


in reply to open vs. sysopen

I'd guess that there's no use POSIX; in the snippet. POSIX.pm is where the O_WRONLY, O_TRUNC and O_CREAT constants are defined.

If my guess is right, you also need to use strict; and use warnings; (see Use strict warnings and diagnostics or die for a good discussion of this), which would point you to the real error - the barewords, O_*.

Update: Strike obviously incorrect info

Replies are listed 'Best First'.
strict, warnings, die...
by sheep (Chaplain) on Dec 26, 2003 at 23:55 UTC
    I do use both: use warnings; and use strict;.
    Even though I was using $! to get the error message, I changed ascii_error() to die() supplying the full error in a reply to one of the posts above. As to the rest of the suggestions the previous reply to your post explains me.

    Thanks,
    -sheep

Re: Re: open vs. sysopen
by Anonymous Monk on Dec 26, 2003 at 21:48 UTC
    I'd guess that there's no use POSIX; in the snippet. POSIX.pm is where the O_WRONLY, O_TRUNC and O_CREAT constants are defined.

    A poor guess. The code shown in the original post clearly has use Fcntl, which by default will export all system F_* and O_* constants.