Note that a single script can't safely use your module twice. This means that any modules that try to use your module can't be safely used with any other such modules. I don't know what your module does, but it seems quite unfortunate to me.
I'd probably have three packages. Here is a simplistic example:
package Your::Module::Bytes;
use bytes;
do $INC{"Your/Module.pm"} . ".pl";
1;
and
package Your::Module::Unicode;
no bytes;
do $INC{"Your/Module.pm"} . ".pl";
1;
and
package Your::Module;
sub import {
# require the desired submodule
# dispatch import to that submodule
}
Note, I'd have to test to make sure that 'use bytes' affects the code included via do, but I believe that it does.
I'm also a bit curious what particular effect of 'use bytes' you need. I thought that such was mostly of use for the earliest versions of Perl Unicode support.
- tye |