Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Perl modules in Windows

by Win (Novice)
on Nov 05, 2003 at 14:38 UTC ( [id://304728]=perlquestion: print w/replies, xml ) Need Help??

Win has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am used to using Perl in Linux. What is the best way to install perl modules in Windows? I have Active Perl.

Replies are listed 'Best First'.
Re: Perl modules in Windows
by DaWolf (Curate) on Nov 05, 2003 at 14:52 UTC
    ActivePerl comes with an utility called PPM (Perl Package Manager, I guess).

    Just open a DOS prompt and type ppm. Then just do "install module-name".

    e.g.: install Net::IRC

    PPM can also search ActiveState so you can find the modules you need. Just type "search term".

    BTW, you can type "help" as well *lol*

    Best regards,

    my ($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br") if ($author_name eq "Er Galvão Abbott");

      If you use a proxy also set these environmental variables as such:

      set HTTP_proxy = http://myproxy.goes.here set HTTP_proxy_user = my_proxy_user_name set HTTP_proxy_pass = my_proxy_password
      Activestate has very good documentation for all that comes with their perl distribution and the modules they supply.

      I have worked out ppm. Now I get the following when I run my program.
      Can't locate DBI/ODBC.pm in @INC (@INC contains:F:/Perl/lib etc etc
      Any explanation? I have already installed:
      3. DBD-ODBC [1.06] ODBC Driver for DBI
        Can't locate DBI/ODBC.pm

        That doesn't sound right, it should be DBD/ODBC. Either you typoed in your script or you didn't cut and paste. The correct syntax is:

        my $dbh = DBI->connect("dbi:ODBC:$dsn",$user,$pass,$attrs);
        A reply falls below the community's threshold of quality. You may see it by logging in.
        A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Perl modules in Windows
by tilly (Archbishop) on Nov 05, 2003 at 15:18 UTC
    To add to what DaWolf said, be warned that the module names as used by ppm are not always the same as the module. My recollections is that sometimes (but far from always) they make everything lower case, and they like replace :: with -. So you might have to install net-irc or Net-IRC rather than Net::IRC.

    Going forward at some point (perhaps now? I don't have Windows to test it) I believe that it should be possible to use CPANPLUS with code that uses Module::Build so that you can install versions of modules without being at the mercy of ActiveState or some other volunteer to repackage them for you. Not many module authors have switched yet though...

      ActiveState uses the distribution name for the package name instead of the primary module. For most modules, this just involves replacing the colons with a dash. For other it is completely different. For example, Net::LDAP is in the perl-ldap package. PPM can't map module names to distributions like CPAN can. search.cpan.org is a big help to find out what distributions a module is found in if the default doesn't work.

      It is possible to use CPAN (and probably CPANPLUS) or manual install with Windows. ExtUtils::MakeMaker supports and uses nmake on Windows. Binary modules are harder to build because they need the environment used to build Perl. For ActivePerl, this is Visual Studio. Building binaries is just harder on Windows; Module::Build does not help much.

        Good information. However I would like to note that if CPANPLUS and Module::Build work as they are supposed to, then pure Perl modules should be installable without having nmake. That won't help if the module uses XS, but it would help with a large fraction of the modules out there.
      True, tilly, but at least since ActivePerl 5.6.1 PPM automatically translates the "::" to "-".

      Actually PPM or maybe ActiveState's repository itself has its caveats, such as it's impossible to install MIME::Lite, 'cause it shows up twice there...

      <UPDATE>
      Actually I was wrong here, and tilly was somewhat correct. If ppm finds more than one result for a module you can choose wich one to install by numbers. PPM 3.0 translates '::' to '-' on the install command, but it doesn't for the uninstall command...
      </UPDATE>

      But to people that are used to work with ActiveState's products - I use Komodo, their multi-language editor - knows that they have some strange bugs sometimes (no flame intended here).

      Justo to be sure that nobody misunderstands me, I love Komodo and I think ActivePerl and PPM are great products, but they sure have it's problems.

      Best regards,

      my ($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br") if ($author_name eq "Er Galvão Abbott");
        The idea of a PPM repository is somewhat novel, but ActiveState is certainly not responsible for it. ExtUtils::Installed and ExtUtils::MakeMaker are. All ActiveState came up with is an XML format to describe packages, prerequisites (PPD). The ppm distribution (module utility and related files) are very poorly managed and maintained (just look at the source http://downloads.activestate.com/PPM/PPM-3.00.56-src.tar.gz, no tests of any kind).
Re: Perl modules in Windows
by jZed (Prior) on Nov 05, 2003 at 15:24 UTC
    While ppm is a good tool and you should certainly learn about it, it has its failings. Activestate is *not* in sync with CPAN and some modules never make it there (particularly ones whose install process requires a human being to answer questions). You can find some of those on other repositories, but even so there are gaps.

    If you use ActivePerl like the OP and have Visual C or you use Cygwin Perl and have gcc, you can compile your own modules just like on *nix -- either use CPAN or CPANPLUS or do manual installs saying the mantra with an extra n (perl Makefile.PL, nmake, nmake test, nmake install). This will work for most modules.

    For pure perl modules you can do a manual install with just nmake.exe (available for free) even if you don't have a C compiler.

      Slacker Answer

      a. 'search *' to find modules on PPM
      'install packagename'

      b. Stick my perl modules in 'd:\Perl\lib' directory

      c. If there is a module on CPAN that isn't on PPM on Windows, I don't sweat it, that is what a Linux computer is for, and vice versa.
Re: Perl modules in Windows
by ajt (Prior) on Nov 05, 2003 at 16:38 UTC

    Hi,

    There are several ways to add modules, depending upon what the module is.

    If it only contains Perl code then you can download it from CPAN and install it manually or use the CPAN shell as normal. You will need to get hold of nmake.exe from Microsoft first.

    If it needs compiling then you need to get a compiler, or get some one else to complie it for you, and then install via ActiveState's PPM tool. Be aware than their PPM repository is only a sub-set of CPAN, and is often out of date. However you can also use PPM to install modules from other PPM Repositories.

    One final option is to install Cygwin and use the version of Perl in there, and you will be able to install most things from CPAN as normal.

    See also:

    Good luck!


    --
    ajt

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://304728]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 23:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found