SPUG: Re: Perl Compiler.

Creede Lambard creede at rrauto.com
Thu Mar 8 18:27:05 CST 2001


Lately I've been using ActiveState's perlapp, which ships with the Perl
Development Kit (PDK) 2.0 for you-should-pardon-the-expression Win32. It's
not actually a compiler, but for Win32 it does a similar function in that it
packages up your Perl app in an executable so you can deliver it to others
without them having to install Perl on their machine. Why anyone would NOT
want to install Perl on their machine is beyond me, but I've heard there are
people who don't even have a computer, much less Perl, so I just sort of
shrug my shoulders and assume it takes all kinds.

An-nee-way . . .

perlapp works quite well but has three minor drawbacks I've encountered so
far:

1. It requires Windows NT to create apps (but once they're created they
should run on any flavor of Win32). Presumably 2000 will work as well. Some
will argue that the fact that it requires any form of Windows is a major
drawback, but hey.

2. It costs $120, but for that you also get some other neat stuff like a
visual debugger, a COM object that exposes a Perl interpreter (so you can
run Perl apps inside of
VB/VC/Delphi/VBScript/anyothercontainerthatunderstandsCOMobjects), and
extensions that will turn your Perl app into a Win32 service or an ActiveX
DLL, if that happens to be your particular kinky inclination, not of course
that there's anything wrong with that. (If you spend lots of time on Windows
I actually think the $120 is quite a bargain, especially if your company
will pay for it.)

3. Occasionally it's not exactly forthright about what needs to go into a
standalone application. Consider this little script:

    #!/usr/bin/perl

    use LWP::UserAgent;
    $ua = new LWP::UserAgent;
    $ua->timeout(20);

    $rq = new HTTP::Request("GET","http://www.slashdot.org");   # So what if
resistance is futile?
    $rc = $ua->request($rq);
    print "Slashdot is up!\n" if ($rc->code =~ /^2/);

If you run this program at a command prompt you will (assuming Slashdot IS
up) see the response, "Slashdot is up." However, if you create a perlapp
from this program with the command

    perlapp -f -c script.pl

and run it, you get this error or something like it:

    Can't locate URI/_foreign.pm in @INC (@INC contains: C:\TEMP\35300000\
.) at URI.pm line 54.

Huh? Where'd URI/_foreign.pm come from? It turns out it's called by
HTTP::Request, which is called by LWP::UserAgent. About an hour of digging
and I finally got the program to run by adding in three modules by hand:

    perlapp -f -c -add=URI::_foreign;LWP::Protocol::http;URI::http script.pl

Just dropping them into a use line in the script didn't work -- the "-add"
line has to be there.

I know this is slightly off the topic of compiling Perl but I thought I'd
mention it since it serves a similar purpose and I can actually get it to
work.

Cheers,
-- Creede

Creede Lambard      | Never rush a miracle man.
Senior Developer    | You get rotten miracles.
Reynolds & Reynolds |
creede at rrauto.com   | - Miracle Max,
                    |    The Princess Bride



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list