On Thu, Sep 23, 2004 at 06:17:41AM -0700, Mathieu Longtin wrote:
> I was trying to use Activestate's perlapp with POE, and ran
> into a snag. Perlapp has trouble with source filters.
>
> Anyway, investigating further, I find that the only filter
> used is the use_bytes macro. For perl versions old enough
> not to have "use bytes" (pre 5.005_55).
>
> I manage to make perlapp work by replacing all the "{%
> use_bytes %}" with plain "use bytes;".
>
> But this begs the question: for the five modules that use
> "use_bytes", couldn't we just code it with BEGIN instead of
> breaking POE in Perlapp?
The bytes pragma was lexically scoped when I tried it, so its effect
didn't exist past the end of BEGIN {} or eval"". POE::Preprocessor
macros were the only way to conditionally include C<use bytes> without
sequestering it off in its own lexical scope.
I did consider an alternative like
BEGIN {
eval "use bytes; sub my_length { return length($_) }";
if ($@) {
eval "sub my_length { return length($_) }";
}
}
but I decided that the function call overhead was too high.
There are obscurely documented workarounds to your problem, though.
See the POE::Preprocessor documentation.
--
Rocco Caputo - http://poe.perl.org/