in reply to Re: conditional enable use bytes for a whole module at compiletime?
in thread conditional enable use bytes for a whole module at compiletime?
BTW, use MODULE is the different than use PRAGMA. You can't use BEGIN { require PRAGMA import PRAGMA LIST; } when you're dealing with pragmas. The BEGIN {} creates a lexical scope of it's own and defeats the purpose of pragmas that affect the lexical scope. Plus, you wouldn't ever be able to do an import on the pragma.package Y; $VERSION = 0.1; 1; package X; my $subs =<<__SUBS__ sub l{ return length shift }; __SUBS__ if ( $Y::VERSION < 1 ){ use bytes; eval $subs; } else { eval $subs; } + + # large module follows + + 1; package main; no bytes; $x = chr(3456); print X::l($x);
|
|---|