ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I'm new to the world of Perl so may have gone about this in the wrong way (my background is mainly Java and Bash).
I have a Perl script (gallery.pl) which takes in various arguments (the only mandatory arguments is a directory full of images) and creates an HTML, standards compliant gallery. Seeing how images might be too big, I use the Image::Magick module to do any resizing that is necessary.
If I want to pass this script to a technically minded user to use then I'd just email the script or put it on my site for them to download and then they can sort out any modules they need to install.
However, what about non-technically minded users? How can I distribute my script in such a way that the end user doesn't have to care about missing dependancies?
I've thought about an installation script to install the main script under /opt/local/bin, could I use this installation script to install missing modules? If so, how might I do this?
I've tried looking at things like Module::AutoInstall and ExtUtils::MakeMaker but my interpretation is that these are only for modules, not for scripts.
Sorry to sound so dim about it all, but as I said, it's all rather new to me!
Last edited by forquare; 07-27-2010 at 08:34 AM.
Reason: Rectify spelling mistake
It essentially 'compiles' a Perl program into an executable. Send it out like you would any other executable, and it'll have everything it needs to run, no tweaking of the environment needed. Works on Linux and Windows, anything that supports Perl.
If you want to distribute the script without compiling it, I'd suggest to NOT automatically install modules because some distributions also package them and the user could very well prefer installing the distribution's package over CPAN...
But you could make your script give better error messages by "require"ing the package in an eval block like this:
print STDERR "Module Image::Magick was not found.\n";
print STDERR "In order to use this script, please install the Image::Magick package for perl.\n";