Reputation: 380
I created a perl script that includes the Switch
module.
hello_world.pl
use strict;
use warnings;
use Switch;
use Data::Dumper;
my $var = "Hello World\n";
print Dumper($var);
if I launch perl hello_world.pl
everything works fine. But if I pack my script with pp hello_world.pl
and than launch ./a.out
it gives me back this error:
Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: CODE(0x7fb2631e6a88) /var/folders/rb/2b5sbs355n57svwzjjh7cb9c0000gn/T/par-6967676c6f62616c33/cache-710e967842eb844ab8d6fe5f46968c1b6f49e019/inc/lib /var/folders/rb/2b5sbs355n57svwzjjh7cb9c0000gn/T/par-6967676c6f62616c33/cache-710e967842eb844ab8d6fe5f46968c1b6f49e019/inc CODE(0x7fb262988de0) CODE(0x7fb262989930)) at script/hello_world.pl line 3. BEGIN failed--compilation aborted at script/hello_world.pl line 3
Upvotes: 0
Views: 274
Reputation: 898
You can try to force the modules to be included, with -M
option:
pp -M Switch -M YAML ...
Upvotes: 0
Reputation: 69294
$ corelist Switch
Data for 2016-05-09
Switch was first released with perl v5.7.3, deprecated (will be CPAN-only) in v5.11.0 and removed from v5.13.1
Switch was never a good idea. It's a source filter which means it's a clever party trick but shouldn't be used in production code. For that reason it has removed from Perl several versions ago.
I suspect that you are running your packaged program on a more recent version of Perl than the unpackaged version - one that no longer includes Switch.
You can install Switch on your target system or you can work out how to get pp
to include the module in the package. But the best solution is to rewrite the code to stop using Switch.
Upvotes: 2