in reply to Re^3: Trying to use App::Fatpacker
in thread Trying to use App::Fatpacker

I completely agree, if we are determined to troubleshoot this, that is the way to go. I don't have all the output saved from the last time I tried this, so I'd need to boot into Ubuntu and install all the modules again.

As I said in the original post, I can live with not knowing why it failed for me because I suspect it's non-trivial and hopefully I won't need to use App::FatPacker much in the future. If someone could help me out with the final output (the 3 modules packed into a script), I'd be grateful. Otherwise, I can fire up Ubuntu again and give you the verbatim output to hopefully help more with the troubleshooting, but I don't think there will be any new info in it.
The packlists file is created with no error messsage and it's fine, the folder structure is created with no error message, but it doesn't contain Spreadsheet::WriteExcel, and the fatpack file; cat myscript.pl) >myscript.packed.pl command throws the error about the missing lib folder. When I manually create an empty lib folder, I get an error message about missing .pm files. That's pretty specific, I'd think.

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

    Have you then, simply, tried to paste the modules at the beginning of your script, or at the end of it? You then just need to replace use Some::Module; with BEGIN{ Some::Module->import() } and that's it.

      I'm a perl beginner, so I didn't.
      I asked about how to do something like this manually in another thread but I got no reply there.
      Thanks for the suggestion, I'll try it later today and report back.

      Just to make sure, by module you mean the complete and unmodified content of the .pm file, right? I guess I need to wrap the content of each .pm in a block of some sort, right? Maybe a sub like so?
      sub HTML::Strip { #content of HTML::Strip's .pm goes here }

        No. You can wrap a whole package in a block:

        { package HTML::Strip; ... rest of HTML/Strip.pm goes here }

        The two things you need to look out for is __END__ blocks or __DATA__ blocks in the modules, and "unclosed" POD sections. You need to close the POD sections and remove everything from __END__ or __DATA__ onwards because Perl stops reading the file at these locations too.

        So if you have an example file HTML/Strip.pm

        package HTML::Strip; sub pole_slide { ... }; 1; __END__ =head1 NAME HTML::Strip =cut

        ... you'd include the following in your main program:

        package HTML::Strip; sub pole_slide { ... }; 1; package main; # use HTML::Strip; BEGIN { HTML::Strip->import() }; # rest of your main program goes here

        This is a slightly different approach than what App::Fatpacker uses, and it requires a bit more human judgement, but it involves much less Perl internals and you'll learn a bit about how packages and modules interact.

        This is perhaps a little counterintuitive for a language with lots of bracketed syntax, but the package Some::Name statement creates its own namespace and such. You can have several packages in one file without extra bracketing around them.