Running a method from a shared, but not bound, PerlApp generated exe

Posted by murrayn on 2015-11-17 17:03
Forums: PDK discussion | OS: All / Any

I've written a Perl script which invokes various class methods written as their own packages in their own ".pm" files in the same directory.

For various reasons I am not able to predict which classes will be required when the script runs so the following code dynamically requires the modules when needed:

for (@classes) {
        unless (is_loaded($_)){require $_ . ".pm"};
}

That works successfully and I can add new class modules (.pm files) to the runtime directory and invoke them by ensuring the script, without modification, inserts the class name into @classes via a config file or the argument list.

I have built my script into a PerlApp exe file and it continues to run as desired dynamically requiring the source .pm class packages.

BUT! I want to ship the script AND the classes as PerlApp packages, not source code to ensure my client doesn't have to install and maintain a Perl interpreter environment.

The PerlApp::extract_bound_file appears to be close to a solution but it talks of BOUND files. I'm coming from the premise that the base script package can be shipped today and new classes may be shipped at a later time as needed without actually combining the new class into the original script exe.

I can build my .pm into a .exe and I can mark it privately sharable but I can't see what to do next (if indeed it's possible to do this).

I guess I'm looking for PerlApp::extract_shared_file instead.