in reply to Can I include O_CREAT, O_EXCEL and O_WRONLY in my script without always requiring Fcntl?

use, as the docs say, is just require and import called at BEGIN time. If you don't want it done then, make the calls yourself:
use strict; use warnings; sub not_really_needed { require SomethingStupid; import SomethingStupid qw(O_CREAT O_EXCL O_WRONLY); }
This program compiles fine, but fails with a runtime error if you add a call to not_really_needed. Replace SomethingStupid with Fcntl and you'll have what you want.

Caution: Contents may have been coded under pressure.
  • Comment on Re: Can I include O_CREAT, O_EXCEL and O_WRONLY in my script without always requiring Fcntl?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Can I include O_CREAT, O_EXCEL and O_WRONLY in my script without always requiring Fcntl?
by rzward (Monk) on Apr 13, 2006 at 18:11 UTC
    Thank you for your help.

    I did read that but I guess I somehow convinced myself require and import are evaluated at compile-time.

    I will experiment with this and the other method.

    Richard