in reply to Re: Re: Re: Re: if only blocks were avoidable...
in thread if only blocks were avoidable...
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:
andpackage Your::Module::Bytes; use bytes; do $INC{"Your/Module.pm"} . ".pl"; 1;
andpackage Your::Module::Unicode; no bytes; do $INC{"Your/Module.pm"} . ".pl"; 1;
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^5: if only blocks were avoidable... (use twice)
by yosefm (Friar) on Sep 23, 2003 at 20:36 UTC |