-2

How can I install a perl module from within a script? I am using a program called Discovery Studio Visualizer which has a scripting interface built-in and I have no way to install Win32::GUI() using standard methods. The reason I want to do this is because I want to create a macro that uses a gui interface to mutate amino acids.

user1876508
  • 12,864
  • 21
  • 68
  • 105

1 Answers1

2

Generally, what you're asking isn't done in Perl. If you don't have access to the Perl tool chain, they probably didn't include the tools necessary to even install the library you want, even if you did use some of the techniques that are available. Further, they may (almost certainly) have locked down the directory that the application is installed in, which would further curtail your ability to install things. If you're using an embedded scripting tool that happens to use Perl as its language, it may not even have the ability to load libraries from additional folders.

That having been said, your best bet is to try to first try installing the library outside of the script. See if you have the cpan command line tool available. cpan is the tool that connects to the Comprehensive Perl Archive Network, pulls down libraries (and dependencies of those libraries) that you need, and knows how to invoke the common installer scripts. Because it uses XS (the Perl interface into C libraries) you will also need a C compiler set up, one that's compatible with whatever compiled the custom version of Perl you used. Finally, the Perl interpreter built into the tool you're using will have to have been compiled in such a way that it can even load those libraries - not a guarantee.

If you can get by with a library that doesn't need compiling and your embedded interpreter is set up to support it, you can create a PERL5LIB environment variable and add the root location of any path containing libraries to this variable. However, most Perl GUI toolkits I know of require compiling.

I certainly wish you luck!

Robert P
  • 15,707
  • 10
  • 68
  • 112