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

I try to
pp @ppopts.txt -o cotes.exe cotes.pl
Where ppopts.txt contains
-M MozRepl -M MozRepl::Client -M MozRepl::Log -M MozRepl::Plugin::JSON -M MozRepl/Plugin/Repl/Back.pm -M MozRepl/Plugin/Repl/Enter.pm -M MozRepl/Plugin/Repl/Home.pm -M MozRepl/Plugin/Repl/Inspect.pm -M MozRepl/Plugin/Repl/Load.pm -M MozRepl/Plugin/Repl/Print.pm -M MozRepl/Plugin/Repl/Rename.pm -M MozRepl/Plugin/Repl/Search.pm -M MozRepl/Plugin/Repl/Util/DocFor.pm -M MozRepl/Plugin/Repl/Util/HelpUrlFor.pm -M MozRepl/Plugin/Repl/Util/DocFor.pm -M MozRepl/Plugin/Repl/Util/HelpUrlFor.pm -M MozRepl/Util.pm
The script cotes.pl runs ok, but the exe made witn the line above fails with
Failed to connect to , Can't locate object method "setup" via package +"MozRepl::Client" at MozRepl.pm line 224.
Thanks for any suggestion F.

Replies are listed 'Best First'.
Re: Packaging a script using WWW::Mechanize::Firefox
by marto (Cardinal) on Jul 14, 2017 at 13:46 UTC

    I always use the -x option when packaging to determine runtime dependancies. Let's take a short example:

    marto@Shemp:~/code$ cat ff.pl #!/usr/bin/perl use strict; use warnings; use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(); $mech->get('http://perlmonks.org');

    Package 1:

    marto@Shemp:~/code$ pp -vvv --log=pp_no_x.log -o ff_no_x ff.pl

    Package 2:

    marto@Shemp:~/code$ pp -vvv --log=pp_with_x.log -x -o ff_with_x ff.pl

    diff the logs:

    marto@Shemp:~/code$ diff pp_no_x.log pp_with_x.log 2c2 < /usr/local/bin/pp: Writing PAR on /tmp/ppaOyYR.par --- > /usr/local/bin/pp: Writing PAR on /tmp/ppLLOin.par 180a181 > /usr/local/bin/pp: ... adding /usr/lib/i386-linux-gnu/perl/5.22.1/St +orable.pm as lib/Storable.pm 296a298 > /usr/local/bin/pp: ... adding /usr/lib/i386-linux-gnu/perl/5.22.1/at +tributes.pm as lib/attributes.pm 394a397 > /usr/local/bin/pp: ... adding /usr/lib/i386-linux-gnu/perl/5.22/auto +/Storable/Storable.so as lib/auto/Storable/Storable.so 396a400 > /usr/local/bin/pp: ... adding /usr/lib/i386-linux-gnu/perl/5.22/auto +/attributes/attributes.so as lib/auto/attributes/attributes.so 603a608 > /usr/local/bin/pp: ... adding <string> as lib/Storable.pm 719a725 > /usr/local/bin/pp: ... adding <string> as lib/attributes.pm 817a824 > /usr/local/bin/pp: ... adding /usr/lib/i386-linux-gnu/perl/5.22/auto +/Storable/Storable.so as lib/auto/Storable/Storable.so 819a827 > /usr/local/bin/pp: ... adding /usr/lib/i386-linux-gnu/perl/5.22/auto +/attributes/attributes.so as lib/auto/attributes/attributes.so 851c859 < /usr/local/bin/pp: *** /tmp/ppaOyYR.par: 2141174 bytes read, 1823518 + compressed, 14% saved. --- > /usr/local/bin/pp: *** /tmp/ppLLOin.par: 2246924 bytes read, 1873647 + compressed, 16% saved. 853c861 < /usr/local/bin/pp: Running /tmp/parl0GIttki -Lff_no_x.log -B -Off_no +_x /tmp/ppaOyYR.par --- > /usr/local/bin/pp: Running /tmp/parleAdFI2Q -Lff_with_x.log -B -Off_ +with_x /tmp/ppLLOin.par 856,859c864,865 < Packing "Config_git.pl"... < Written as "Config_git.pl" < Packing "Config.pm"... < Written as "Config.pm" --- > Packing "Config_heavy.pl"... > Written as "Config_heavy.pl" 861a868,869 > Packing "Config_git.pl"... > Written as "Config_git.pl" 864,865c872,873 < Packing "Config_heavy.pl"... < Written as "Config_heavy.pl" --- > Packing "Config.pm"... > Written as "Config.pm"

    The packages created are self extracting zip files, so you could just unzip and explore, but it's best to log and compare differences. This comes up fairly regularly, I'll work on a mini tutorial. See also Very Odd Issue When Using pp to Create an .exe File Including Date::Calc/Super Search.

Re: Packaging a script using WWW::Mechanize::Firefox
by frazap (Monk) on Jul 14, 2017 at 13:18 UTC
    Well, I wa missing these modules to add to the list above
    -M Firefox/Application/API40.pm -M Storable.pm -M Sub/Name.pm -M arybase.pm -M attributes.pm
    Now it works ok... Note : this is on a windows 10 box.