in reply to Re: use bytes without breaking perl 5.005 or 5.004?
in thread use bytes without breaking perl 5.005 or 5.004?
Cool.
I had previously convinced myself that because BEGIN requires a block, I couldn't fake out 'use warnings' for people who don't have it but then I realized this works fine:
because the pragmas already expect to be inside of a (invisible) block and so apply themselves to one block further out.BEGIN { if( eval { require warnings } ) { warnings->import(); } else { $^W= 1; } }
I like this method because it allows the user to install a back-ported warnings.pm or bytes.pm or whatever and use it if they want to and I don't have to trust my knowledge of when the module was added. (:
Anyway, it is another way to do it.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Is this fundamentally different than my original try?
by joshclark (Novice) on Sep 28, 2003 at 14:02 UTC | |
by tye (Sage) on Sep 29, 2003 at 03:56 UTC |