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


in reply to Again with PAR::Packer troubles

Add
use IO::Socket::SSL qw(debug99);
and you'll get this from a.exe
DEBUG: IO/Socket/SSL.pm:1213: Invalid certificate authority locationse +rror:02001003:system library:fopen:No such process SSL error: 1724: 1 - error:2006D080:BIO routines:BIO_new_file:no such + file SSL error: 1724: 2 - error:0B084002:x509 certificate routines:X509_lo +ad_cert_crl_file:system lib

Problem, PAR doesn't know about C:\perl\site\5.14.1\lib\Mozilla\CA\cacert.pem, it doesn't pack it along with C:\perl\site\5.14.1\lib\Mozilla\CA.pm

Solution, add the file with

-a "C:\perl\site\5.14.1\lib\Mozilla\CA\cacert.pem;cacert.pem"

then in your .pl tell LWP about it

$ENV{PERL_LWP_SSL_CA_FILE} = File::Spec->catdir( $ENV{PAR_TEMP}, 'cacert.pem');

update: After testing, I see cacert.pem doesn't end up in root, so you'd have to something like

$ENV{PERL_LWP_SSL_CA_FILE} = File::Spec->catdir( $ENV{PAR_TEMP}, qw[ i +nc perl site 5.14.1 lib Mozilla CA cacert.pem ] );

Or specify a path where to install, like -a "C:\perl\site\5.14.1\lib\Mozilla\CA\cacert.pem;/cacert.pem" forget it, you'd have to use PAR::read_file for it to get unpacked, bah caveats

If Mozilla::CA had used File::ShareDir, you would simply add use File::ShareDir::PAR; to your .pl and it would just work

So, the bugs are as follows

Replies are listed 'Best First'.
Re^2: Again with PAR::Packer troubles
by jellisii2 (Hermit) on Aug 17, 2011 at 14:30 UTC

    The certificate file was the lynchpin.

    PP command:

    pp mech_test.pl -l \Perl\lib\Mozilla\CA\cacert.pm

    I've dealt with having to find files that I've had to include in PP built packages before. Here's how to deal with this particular one:

    use File::Spec; if (exists $ENV{PAR_PROGNAME}) { $ENV{PERL_LWP_SSL_CA_FILE} = File::Spec->catfile( $ENV{PAR_TEMP}, 'cacert.pem' ); }

    I can't remember where I got that gem from, but it helped me when I was first starting to build Tkx apps. In my case, I stick this in a BEGIN block, so that the environment is right before I do anything else.

    Thank you all for your patience and help.