Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: use bytes without breaking perl 5.005 or 5.004? (same)

by tye (Sage)
on Sep 29, 2003 at 03:56 UTC ( #294867=note: print w/replies, xml ) Need Help??


in reply to Is this fundamentally different than my original try?
in thread use bytes without breaking perl 5.005 or 5.004?

Yes, same result. Here is how I tested it:

> perl { use warnings; } print $x; <EOF> > perl BEGIN { if( {require warnings} ) { warnings->import(); } } print $x; <EOF> Use of uninitialized value in print at - line 3. > perl BEGIN { eval { require warnings; import warnings; } } print $x; <EOF> Use of uninitialized value in print at - line 3. >
First is the "control" case to show that 'use warnings' inside of a block doesn't have an effect outside of the block. Next is my method, and the warning generated shows that there is an effect (since I have warnings.pm in this version of Perl). Last is your method, which also works.

The 'hint' pragmas all work very much the same so this trick works for 'strict', 'warnings', 'bytes', etc.

                - tye

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://294867]
help
Chatterbox?
LanX imagines which nations would be dominating if the winter olympics were invented in East Asia
[LanX]: Corion: and that's the clue how Germany can dominate Handball tournaments, just continuing the domestic league and forbidding the best players of the world to attend :)
LanX (which would be a good scheme for England and football too)
[LanX]: If "Canada will play the Czech Republic for bronze on Saturday", that means Germany will play Syria in disguise...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2018-02-23 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (303 votes). Check out past polls.

    Notices?