http://www.perlmonks.org?node_id=890146

Hue-Bond has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed monks,

I'm trying to make an .exe file out of a little program using Mojolicious::Lite. It's Strawberry Perl 5.12.0 on Windows XP SP2 (perl built for MSWin32-x86-multi-thread).

The code couldn't be simpler:

#!/usr/bin/perl use Mojolicious::Lite;

This is what happens when I try to build it:

> pp -o use-mojo.exe use-mojo.pl > use-mojo.exe Can't locate Mojolicious.pm in @INC (@INC contains: CODE(0x13ddff4) C: +\DOCUME~1\hue\CONFIG~1\Temp\par-hue\cache-b63530375d9cac583a4739b81f2 +5c342b562e895\inc\lib C:\DOCUME~1\hue\CONFIG~1\Temp\par-hue\cache-b63 +530375d9cac583a4739b81f25c342b562e895\inc CODE(0x121b2fc) CODE(0x121b +5fc)) at Mojo/Base.pm line 31. BEGIN failed--compilation aborted at Mojolicious/Lite.pm line 2. Compilation failed in require at script/use-mojo.pl line 3. BEGIN failed--compilation aborted at script/use-mojo.pl line 3.

Hmm well, ok, let's manually include the missing module:

> pp -M Mojolicious -o use-mojo.exe use-mojo.pl > use-mojo.exe Can't locate Mojo.pm in @INC (@INC contains: CODE(0x1360614) C:\DOCUME +~1\hue\CONFIG~1\Temp\par-hue\cache-32243079ff9cdbe34fb6720d972d912551 +5e65d7\inc\lib C:\DOCUME~1\hue\CONFIG~1\Temp\par-hue\cache-32243079ff +9cdbe34fb6720d972d9125515e65d7\inc CODE(0x121b2fc) CODE(0x121b5fc)) a +t Mojo/Base.pm line 31. BEGIN failed--compilation aborted at Mojolicious.pm line 2. Compilation failed in require at Mojo/Base.pm line 31. BEGIN failed--compilation aborted at Mojolicious/Lite.pm line 2. Compilation failed in require at script/use-mojo.pl line 3. BEGIN failed--compilation aborted at script/use-mojo.pl line 3.

Ok, maybe it's another kind of problem. Let's try with -I:

> perl -MMojolicious -MMojo -le "print $INC{'Mojolicious.pm'}; print $ +INC{'Mojo.pm'}" C:/strawberry/perl/site/lib/Mojolicious.pm C:/strawberry/perl/site/lib/Mojo.pm > pp -I C:/strawberry/perl/site/lib -o use-mojo.exe use-mojo.pl > use-mojo.exe Can't locate Mojolicious.pm in @INC (@INC contains: CODE(0x13ddff4) C: +\DOCUME~1\hue\CONFIG~1\Temp\par-hue\cache-362b7854cb57139506964b066a4 +ae6568fad1611\inc\lib C:\DOCUME~1\hue\CONFIG~1\Temp\par-hue\cache-362 +b7854cb57139506964b066a4ae6568fad1611\inc CODE(0x121b2fc) CODE(0x121b +5fc)) at Mojo/Base.pm line 31. BEGIN failed--compilation aborted at Mojolicious/Lite.pm line 2. Compilation failed in require at script/use-mojo.pl line 3. BEGIN failed--compilation aborted at script/use-mojo.pl line 3.

Uh, I'm back to square 1. Same result if I try with backslashes.

Well, at this point I made a .bat file with a bunch of modules and tried with it. This is the batch:

pp ^ -I . ^ -I C:\strawberry\perl\site\lib ^ -I C:\strawberry\perl\site ^ -M Mojolicious ^ -M Mojo ^ -M Mojo::Asset ^ -M Mojo::Base ^ -M Mojo::ByteStream ^ -M Mojo::Cache ^ -M Mojo::Client ^ -M Mojo::Command ^ -M Mojo::Content ^ -M Mojo::Cookie ^ -M Mojo::CookieJar ^ -M Mojo::Date ^ -M Mojo::DOM ^ -M Mojo::Exception ^ -M Mojo::Headers ^ -M Mojo::HelloWorld ^ -M Mojo::Home ^ -M Mojo::IOLoop ^ -M Mojo::JSON ^ -M Mojo::Loader ^ -M Mojo::Log ^ -M Mojo::Message ^ -M Mojo::Parameters ^ -M Mojo::Path ^ -M Mojo::Server ^ -M Mojo::Template ^ -M Mojo::Transaction ^ -M Mojo::Upload ^ -M Mojo::URL ^ -M Mojo::Util ^ -o use-mojo.exe use-mojo.pl

And the output:

> use-mojo.exe script: No such file or directory at Mojo/Home.pm line 25 BEGIN failed--compilation aborted at script/use-mojo.pl line 3.

It seems I've advanced a little, but I guess there's a better (less explicit/verbose) way to build the .exe and I shouldn't be using this batch file.

I've googled around (with and without site:perlmonks.org) to no avail. I guess I must be missing some bit along the way but can't figure out which one it is. Any idea? Thanks!

--
 David Serrano
 (Please treat my english text just like Perl code, i.e. feel free to notify me of any syntax, grammar, style and/or spelling errors. Thank you!).