rschupp / PAR-Packer

(perl) Generate stand-alone executables, perl scripts and PAR files https://metacpan.org/pod/PAR::Packer
Other
48 stars 13 forks source link

Plugin "HeaderCondition" missing #54

Closed leandrocombr closed 1 year ago

leandrocombr commented 2 years ago

Hello

I'm using the command

pp -f Crypto -M Filter::Crypto::Decrypt -o script.pl mojo.pl

log erro

Plugin "HeaderCondition" missing, maybe you need to install it?
BEGIN failed--compilation aborted at script/script.pl line 6.

Hello

I'm using the command

Script mojo.pl

!/usr/bin/perl

use Mojolicious::Lite -signatures;

use Mojolicious::Static; use POSIX qw(strftime); use HTML::Entities; use DBI; use JSON;

get '/' => 'index';

Rest of the code I cut (works)

app->mode('production'); app->secrets(['U0dWaFpHVnlRMjl1WkdsMGFXOXVmZHJ0dDU0NnlqNzY1eXRqeXR5dHNkZmRmZHM']); app->start;

DATA

@@ index.html.ep <!DOCTYPE html>

Test Test....
rschupp commented 2 years ago

Try pp -M Mojolicious::Plugin::* ... BTW, this has nothing to do with -f Crypto, please choose a better subject line next time.

leandrocombr commented 2 years ago

-sh-4.2$ ./script.pl Use of uninitialized value $output in substitution (s///) at /tmp/par-62725f61746875733632/cache-985d882c1f16b22c4554c77b8ab890aeee72dd29/inc/lib/Mojo/Util.pm line 136. Use of uninitialized value $output in substitution (s///) at /tmp/par-62725f61746875733632/cache-985d882c1f16b22c4554c77b8ab890aeee72dd29/inc/lib/Mojo/Util.pm line 137. Use of uninitialized value $str in split at /tmp/par-62725f61746875733632/cache-985d882c1f16b22c4554c77b8ab890aeee72dd29/inc/lib/Mojo/Util.pm line 357. Use of uninitialized value in concatenation (.) or string at /tmp/par-62725f61746875733632/cache-985d882c1f16b22c4554c77b8ab890aeee72dd29/inc/lib/Mojolicious/Commands.pm line 12.

Commands:

See 'APPLICATION help COMMAND' for more information on a specific command.

Showed this error do I need to add another line?

Sorry for the title! Fix it!

rschupp commented 2 years ago

Use of uninitialized value $output in substitution (s///) at /tmp/par-62725f61746875733632/cache-985d882c1f16b22c4554c77b8ab890aeee72dd29/inc/lib/Mojo/Util.pm line 136.

Let's look at the source (Mojo/Util.pm):

sub extract_usage {
  my $file = @_ ? "$_[0]" : (caller)[1];

  open my $handle, '>', \my $output;
  pod2usage -exitval => 'noexit', -input => $file, -output => $handle;
  $output =~ s/^.*\n|\n$//;              # line 136
  $output =~ s/\n$//;

  return unindent($output);
}

If pod2usage doesn't find any POD in $file, then it will not write anything on $handle, hence $output will still be undef and that's the "uninitialized value" warning. The rest of the warnings stem from this undef being passed up the return chain.

Why may there be no POD in this $file? Probably because the source of all modules packed by pp are filtered by PAR::Filter::PodStrip by default. If $file refers to your top level script, this shouldn't be filtered by PodStrip, but might be a side effect of -f Crypto.