(Harald Jörg)
2015-04-20 21:05:35 UTC
Hello PARty,
I'm new to PAR and pp and am trying to use it to package a fairly large
application so that Windows users who don't have Perl installed can
simply double-click the application. I've managed to overcome some
pitfalls (missing DLLs, dynamic loading of modules which Scandeps can't
find), but there's still one thing I don't understand, and Google didn't
point me into an explanation so far.
What I'm trying to achieve: The Perl application can be extended with a
plugin mechanism. In plain Perl, this is done by dropping the modules
to special subdirectories, the application will pick them up. Now, I
want to let users do the same thing on top of the pp executable.
So I thought that I could just
use lib 'foo';
in my source, and then drop the plugins to directory 'foo'. To my
disappointment, this fails, the modules aren't found. Drats.
To my utter surprise, I got it working like this:
use lib 'foo';
use lib 'bar';
...and then dropping the plugins to 'foo'. Now the questions:
* is that intended / accidental behaviour?
* is there a better way to do what I want?
Here's a simple demo: 'foo' is added to @INC as intended, 'bar' isn't.
----------------------------------------------------------------------
$ cat local_includes.pl
use Data::Dumper;
use lib 'foo';
use lib 'bar';
print Dumper(\@INC);
$ pp local_includes.pl
$ ./a.out
$VAR1 = [
'foo',
sub { "DUMMY" },
'/tmp/par-68616a/cache-5bde0b3f6eab9c5f0be91ed26371a4bb8b7cbac1/inc/lib',
'/tmp/par-68616a/cache-5bde0b3f6eab9c5f0be91ed26371a4bb8b7cbac1/inc',
sub { "DUMMY" },
sub { "DUMMY" }
];
----------------------------------------------------------------------
--
Cheers,
haj
I'm new to PAR and pp and am trying to use it to package a fairly large
application so that Windows users who don't have Perl installed can
simply double-click the application. I've managed to overcome some
pitfalls (missing DLLs, dynamic loading of modules which Scandeps can't
find), but there's still one thing I don't understand, and Google didn't
point me into an explanation so far.
What I'm trying to achieve: The Perl application can be extended with a
plugin mechanism. In plain Perl, this is done by dropping the modules
to special subdirectories, the application will pick them up. Now, I
want to let users do the same thing on top of the pp executable.
So I thought that I could just
use lib 'foo';
in my source, and then drop the plugins to directory 'foo'. To my
disappointment, this fails, the modules aren't found. Drats.
To my utter surprise, I got it working like this:
use lib 'foo';
use lib 'bar';
...and then dropping the plugins to 'foo'. Now the questions:
* is that intended / accidental behaviour?
* is there a better way to do what I want?
Here's a simple demo: 'foo' is added to @INC as intended, 'bar' isn't.
----------------------------------------------------------------------
$ cat local_includes.pl
use Data::Dumper;
use lib 'foo';
use lib 'bar';
print Dumper(\@INC);
$ pp local_includes.pl
$ ./a.out
$VAR1 = [
'foo',
sub { "DUMMY" },
'/tmp/par-68616a/cache-5bde0b3f6eab9c5f0be91ed26371a4bb8b7cbac1/inc/lib',
'/tmp/par-68616a/cache-5bde0b3f6eab9c5f0be91ed26371a4bb8b7cbac1/inc',
sub { "DUMMY" },
sub { "DUMMY" }
];
----------------------------------------------------------------------
--
Cheers,
haj