http://qs1969.pair.com?node_id=217408

lclemmer has asked for the wisdom of the Perl Monks concerning the following question:

Hello,
So I've got a functioning .pl script that runs without errors, listening for network traffic. I decide to use PerlApp to make it a freestanding .exe file.

The program is built with no errors, but when it runs it dies with the following error:

Can't locate object method "Select" via package "IO::Select" at IO/Socket.pm line 168. The IO::Select module is being added at compile time, so that's not the problem. When I look at line 168 of IO::Socket I don't see what the problem is--it's just a require statement for Select.

Oddly, when I built the .exe as a non-freestanding application (requiring Perl on the box) it runs without this error.

Has anyone seen this before, and is there a way to make it work??? I really can't install Perl on the systems this is going to run on (as much as I might want to).
Lee

  • Comment on ActiveState's PerlApp is causing an odd problem with IO:Socket

Replies are listed 'Best First'.
Re: ActiveState's PerlApp is causing an odd problem with IO:Socket
by cmapuk (Novice) on Dec 04, 2002 at 11:54 UTC
    Did you use perlapp options?


    Save me, St.Perldoc!
      http://aspn.activestate.com/ASPN/Perl/Reference/Products/PDK/PerlApp/Options.html


      Save me, St.Perldoc!
      Yes, sorry for the lack of detail in the overview. Here are the command line options used:

      perlapp -s=junksenders_server.pl -e=exch_junksend.e e -freestanding -report -verbose Input script name: junksenders_server.pl Output exe name: exch_junksend.exe

      The PerlApp version is 2.1.

      Hmmm...

        Also interesting to note, I just built a freestanding .exe of the client portion of the client->server app and it works fine.

        The problem with select in IO::Socket (not surprisingly really) only manifests itself when creating a listener.
        Well, I suppose I could drag just the portions of the Perl directory structure that the program needs and add the environment variable to the systems hosting it, but I don't wanna!
        Argh.

Re: ActiveState's PerlApp is causing an odd problem with IO:Socket
by jplindstrom (Monsignor) on Dec 04, 2002 at 16:53 UTC
    It sounds like the module isn't included, and hence isn't used properly at app runtime. It's probably dynamically loaded in a way that PerlApp has problems detecting when deciding which modules to bring along at build time.

    The canonical way to solve that problem is to explicitly "use" the module somewhere in your script (preferrably with a little note about PerlApp acting up). But from "IO::Select module is being added at compile time" I take it that you already do that.

    What if you "add" or "bind" the file manually with a command line option?

    perlapp -h for syntax.


    /J

      Um. I guess I'm not being clear enough. Thanks for the suggestions, but no joy here.

      When I saw the problem the first thing I tried was to put in a "use IO::Select", then a "require IO::Select" to see if that made a difference. It didn't. Importantly in all cases PerlApp is still smart enough to find the dependent module and tell us:

      Adding Module: e:/Perl/lib/IO/Socket.pm Adding Module: e:/Perl/lib/IO/Select.pm

      The problem isn't that the module isn't there, it's that for some reason the standalone exe is having trouble doing the "method call" to that module, but when using regular perl libraries, install environment, whatever it works fine.

      So, any other ideas?

Re: ActiveState's PerlApp is causing an odd problem with IO:Socket
by guha (Priest) on Dec 04, 2002 at 16:55 UTC

    In my PerlApp 4.1.2 the info below is found in the docs.

    --add <list>
    List additional modules to include in the executable.
    PerlApp will also try to include modules that the listed modules depend on. Multiple modules can be separated by whitespace or a semi-colon. The option can be repeated.

    For example:
    perlapp myscript.pl --add IO::Socket;XML::Parser::Expat
    would cause IO::Socket and XML::Parser to be included in your executable.

    Your PerlApp version seems older, so the syntax may have changed
    HTH

      Thanks for the reply,

      Yes, the syntax is the same. I'm puzzled too as I *thought* I had a newer version of PerlApp (and the Dev kit)

      However, that bit doesn't help. PerlApp already saw the use of the module and included it, and manually/explicitly putting it in there doesn't help. Same error.

      Any other ideas, anyone?

        From Socket.pm:

            my $sel = new IO::Select $sock;

        This code works fine when I use socket functions in runtime perl, and it works fine with PerlApp compiled code that is "dependent" on Perl being on the system. It's the freestanding version only that doesn't work.

        The modules are getting added to the .exe when it's compiled, and they're explicitly use'd in the program.

        I'm going to go dig up a newer version of PerlApp if I have it here and see what happens.

        Lee