I'm working on an enterprise monitoring solution using POE (.2802), perl 
(5.8.3) and perl2exe (8.10b) (http://www.indigostar.com/perl2exe.htm). 
perl2exe is an environment that lets you bundle a perl nterpreter with the 
precompiled perl code (byte-code?) into an executable (I think it is 
similar to perlapp) so you can run your app as a standalone. In general 
for these kinds of things (e.g. perl2exe), you can't do anything like 
loading a module at runtime without it already having been visibile to 
perl2exe at compile time. So eval "require SomethingObsure.pm" will fail 
unless you "use SomethingObscure" in advance when you are compiling your 
standalone.

So I found the relevant section in POE::Preprocessor regarding perlapp 
support (contributed by Zoltan Kandi) and that helps understand what is 
going on for certain run-time generated sections of POE. But I'm thinking 
that some of the recent changes to POE in order to support XS based event 
loops and other XS based things has caused more steps to need to be taken 
to get it to work with perl2exe. For instance from CHANGES:

  2003-12-12 04:05:06 by rcaputo; lib/POE/Kernel.pm 1.269;
  lib/POE/Loop/Event.pm 1.35; lib/POE/Loop/Gtk.pm 1.42;
  lib/POE/Loop/Poll.pm 1.26; lib/POE/Loop/Select.pm 1.53;
  lib/POE/Loop/Tk.pm 1.43; lib/POE/Loop/TkActiveState.pm 1.7;
  lib/POE/Loop/TkCommon.pm 1.4

    Remove the hardcoding for POE::Loop classes. Now POE::Kernel will
    walk %INC and compare each module against the files in ./Loop (where
    "." is wherever POE::Kernel is, according to __FILE__).

and

2003-12-16 04:55:42 by rcaputo; lib/POE/Resources.pm 1.4

    Support auto-loading POE::XS::Resource::Foo if it's available. Fall
    back to POE::Resource::Foo if the XS version isn't available or
    cannot load.

Now one of the things perl2exe does is to override eval and require so 
that it spits out a message slightly different from the standard when 
including modules that don't exist:

PLEASE SEE THE PERL2EXE USER MANUAL UNDER "Can't locate somemodule.pm in 
@INC"
FOR AN EXPLANATION OF THE FOLLOWING MESSAGE:
Can't locate SomethingObscure.pm in @INC...

This presents a problem if you are eval'ing and you want to match $@ with 
/^Can't locate/.

So to get perl2exe to work with POE and my stuff I had to do two 
additional things:

1) In POE::Kernel relax all the pattern matches $@ from eval from /^Can't 
locate/ to /Can't locate/.
2) In my source script (for compiling with perl2exe) I had to explicitly 
add all of the POE::Resource's:
use POE::Resource::Aliases;
use POE::Resource::Events;
use POE::Resource::Extrefs;
use POE::Resource::FileHandles;
use POE::Resource::SIDs;
use POE::Resource::Sessions;
use POE::Resource::Signals;
use POE::Resource::Statistics;

And then it works. So I'm wondering if I am on the right track here or if 
there might be a better way? Especially since I don't find it healty to 
modify POE::Kernel in any way.

regards,
Lance

-
Lance Braswell - + 1 469 357 6112 

Reply via email to