Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (0)

Powered by Vanilla. Made with Bootstrap.
Installing Perl Modules [Linux]
  • Sh3llc0d3
    Posts: 1,910
    Ok, well as in other languages you need header files or modules to use specific features such as the cmath header in C++ to use certain maths functions you need to do the same in Perl. These neccessary files are known as modules, perl modules or .pm files.

    For instance we will take the libnet as an example:

    we go to http://search.cpan.org/ and search for "libnet" this should bring up several results but we want the bundle (which should be the first result). Here's the link eitherway. Now we've found the module page you'll see on the right hand side the download link... download it and note where you save it.

    Find the downloaded file/module using a shell and run the following to decompress the tarred file:
    gzip -dc file.tar.gz | tar -xof -


    Then to unpack the resulting file use:
    tar -xof file.tar


    The above will give you an extracted directory. Enter this directory using "cd directory/". Then type:
    perl Makefile.PL


    make


    make test


    You don't really need to be root for the previous commands however you now need to switch to root if you haven't already using either "sudo su" then enter your password or:
    sudo make install

    Then enter your password when requested.

    That ladies and gents is your perl module installed. To include the perl module just add this to the start of your script:
    use Net::Libnet


    This guide was made with the knowledge I picked up from CPAN.org so the guides may be similar.
    S-P
  • sangf
    Posts: 203
    on windows (using strawberry perl), you can install modules using their cpan client via commandline (for example MIME::Base64 module):

    cpan MIME::Base64



    NAME
    cpan - easily interact with CPAN from the command line

    SYNOPSIS
    # with arguments and no switches, installs specified modules
    cpan module_name [ module_name ... ]

    # with switches, installs modules with extra behavior
    cpan [-cfgimt] module_name [ module_name ... ]

    # with just the dot, install from the distribution in the
    # current directory
    cpan .

    # without arguments, starts CPAN.pm shell
    cpan

    # dump the configuration
    cpan -J

    # load a different configuration to install Module::Foo
    cpan -j some/other/file Module::Foo

    # without arguments, but some switches
  • undead
    Posts: 822
    Nice guide :)
  • Sh3llc0d3
    Posts: 1,910
    For Linux also you could use "CPAN mod::mod" Change mod::mod for the module name you want/need to install.