Hi,
I like to enable
use bytes for a whole module, only if a condition is true. But since
use bytes is out of scope, outside of the
if, it has no effect. Sure I know I can wrap every function with the test, but I hope for a easy solution at the top of the module.
Here is a example, the desired output is
3.
BEGIN {
package Y;
$VERSION = 0.1;
1;
package X;
if ( $Y::VERSION < 1 ) {
# How to enable use bytes for the whole modue X?
# with condition $Y::VERSION in mind?
use bytes;
}
sub l{ return length shift }
# large module follows
1;
}
package main;
no bytes;
$x = chr(3456);
print X::l($x);