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

Some background info (skip to next paragraph for the current problem):

I have a perl script that I need to make portable. I don't want users to have to install stuff for it to work on their machnies.
I have found that packaging apps with PAR::Packer can break easily, specifically PAR::Packer executables fail to run on older OS versions than the one they were made on. I tried the -P option to create a perl script instead of an executable, but that seems to do something totally different from what I want. So I turned to App::Fatpacker which claims to do exactly what I want it to: move all the dependencies (modules) into my script and allow it to run "as is" on any computer that has a perl interpreter.


So I tried running App::FatPacker on Windows, it doesn't seem to be designed to do that. So I tried it with a Ubuntu 8.04 live cd and a 10.10 live cd (I don't have a permanent Ubuntu install at the moment). Both failed with different error messages. 8.04 failed on the fatpack file command with Can't stat /folder/lib: No such file or directory. It hadn't created a lib directory, only fatlib so no wonder it didn't find any... When I made an empty lib folder for it, it still failed with some other error, as did 10.10 even earlier. IIRC 8.04 complained that the .bs and .so files weren't .pm files so they couldn't be packed and it found no .pm files. Now, the fatlib folder it created contained two subfolders: HTML and auto. HTML had the .pm files and auto had .bs and .so files in subfolders. So perhaps moving the .pm's to the auto folder would have fixed that issue, but there's another catch: the project uses Spreadsheet::WriteExcel as well, which was correctly listed in the packlists file but didn't make it into the fatlib folder at all, so it would be missing even if the hack fixed the problem with the other modules. I certainly hope that it's possible to package up Spreadsheet::WriteExcel with App:Fatpacker and it wasn't skipped because of some incompatibility (I got no such error message).

At this point after all these errors, I think spoonfeeding App::FatPacker may not work, although if you have suggestions on how to make it work, I'm all ears.

If anyone managed to get this thing to work, it may be simpler to just "borrow" their App::FatPacker instead of fixing mine, which involves booting into a slow live CD and reinstalling all 4 modules again for every new test.
If I understand this correctly, then what App:FatPacker does is migrate the modules into your script. I imagine it should be possible to run it on a five-line dummy script, packing the 3 required modules in there, and then swapping out the dummy script with any other script that needs those modules. Is that correct, or does App::FatPacker need to change things inside the script itself (i.e. adapt the commands that use the modules)? So, could a kind monk do me a solid and just package the modules up for me? I would need HTML::Entities (part of HTML::Parser), HTML::Strip and Spreadsheet::WriteExcel. Or is this not feasible? Again, I would love to be able to do this myself but App::FatPacker seems to be pretty far from functional on my machine.

Replies are listed 'Best First'.
Re: Trying to use App::Fatpacker
by Corion (Patriarch) on Nov 03, 2010 at 09:19 UTC

    You don't show us what exactly you did, so it's hard to see what might have gone wrong. /folder/lib looks like it is from an example, so did you use that verbatim or is it just an example by you?

    In a unixish environment, the synopsis of App::FatPacker should work. On Windows with cmd.exe you need to replicate what the steps in shell syntax do, which is a bit more unwieldly.

      That's the real output I got, I just replaced my long and boring real path with /folder/lib to make the error message a bit easier to read.

      I completely agree that the synopsis of App::FatPacker should work, but it doesn't.
      fatpack trace myscript.pl fatpack packlists-for `cat fatpacker.trace` >packlists fatpack tree `cat packlists` (fatpack file; cat myscript.pl) >myscript.packed.pl
      ... is exactly what I tried. The error about .pm files not being found came on the last command.

        I think what would help us to help you better would be a complete terminal session with the exact commands you issued, the exact errors that the programs produced, and also whether any files were created and what their contents are. Without that, all we can do is guess based on your description, which I don't feel gets us further.

Re: Trying to use App::Fatpacker
by elef (Friar) on Nov 04, 2010 at 21:11 UTC
    Thanks for all the help, everyone. I'm sure the info on the manual method will come in handy at some point, but I eventually managed to get App::Fatpacker to work on Spreadsheet::WriteExcel.

    I manually created a lib folder and copied the module's folder structure into it before running the last App::Fatpacker command and it worked. I'm not sure why it didn't work out of the box, but I'll take the end result.