-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I'm using PAR/pp to package my Perl/Tk app, and it's all good. Now I'm moving in the direction of setting up a simple plugin architecture to distribute plugins for my app. It seems like PAR would be the natural choice to do that, as I'd be able to have the plugins include extra modules in their PAR files to increase functionality, while still allowing the users to run the apps without having Perl installed locally.
I'm pretty stumped, though, as to the best way to implement this. Currently, I've got code that does something like this:
foreach my $file ( glob( catfile( $config{plugin_dir}, "*.pl" ) ) )
{
require $file;
}And the .pl files in the plugin_dir provide the functionality. That's working fine at present. For the purposes of discussion, let's say we're working with a plugin named scoreboard.pl.
My first thought was to package scoreboard.pl as scoreboard.par, so I did:
pp -p -o scoreboard.par scoreboard.pl
Then, moving scoreboard.par into the plugin_dir, I changed the code to:
foreach my $file ( glob( catfile( $config{plugin_dir}, "*.par" ) ) )
{
print "Using file $file\n";
use PAR $file;
require "scoreboard.pl";
}When I run the app, I get:
Using file /home/minter/mrvoice/trunk/plugins/scoreboard.par
Can't locate scoreboard.pl in @INC (@INC contains: CODE(0x9ec6e14) /usr/lib/perl5/5.8.5/i386-linux-thread-multi ....)
The pp/par docs tend to focus more on packaging things and then using modules from within them, which I suppose is another way it could work, but I'd need to have a way to package arbitrary plugins into .par files, use the .par, then find some way of telling the app "run the code or module that's specified in this particular .par", which seems like it would be tricky if the main program doesn't know the name of what's been included until runtime.
So I'm pretty much stumped as to how I'd:
1) Take a .pl file and package it as a .par
2) Execute the .pl from within the .par as I was doing with the require line at first.
If anyone has any suggestions, I'd appreciate them.
- --Wade -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD)
iD8DBQFB7XNQo4DwsyRGDscRAsTCAJ9TjxyvXWYN4Kk+er53kWotqwpoEgCdEVXi JGYV9zp1pHFVtPm3NzBoDqA= =Y3VK -----END PGP SIGNATURE-----
