Perl

De Linuxmemo.


Sommaire

[modifier] Modules Perl (installation)

[modifier] Via apt-get

You can easily install Perl modules using apt-get, the package name usually starts with lib and ends with -perl like: libsomething-perl. For e.g. libarray-compare-perl, libarchive-zip-perl, libnet-pcap-perl or libnet-dns-perl.

  • To search for package run: apt-cache search string
  • To install a package run: apt-get install packagename. For e.g. apt-get install libnet-dns-perl
  • To read more info about the package: apt-cache show libnet-dns-perl. Output from my box:

[modifier] CPAN

[modifier] Dependencies de CPAN

apt-get install libyaml-perl unzip make bzip2 curl lynx ncftp ftp patch makepatch

[modifier] Install des modules Perl

perl -MCPAN -e shell
install HTML::Template

The CPAN tools only install the latest version of any distribution because PAUSE only indexes the latest version.

[modifier] To enable CPAN behind proxy, invoke CPAN Shell as

perl -MCPAN -e shell

will give you prompt as

cpan[2]>

Now we have to set the proxy type following command

cpan[2]> o conf init /proxy/

If you're accessing the net via proxies, you can specify them in the CPAN configuration or via environment variables. The variable in the $CPAN::Config takes precedence.

Your ftp_proxy? [a.b.c.d] ftp://a.b.c.d:port
Your http_proxy? [a.b.c.d] http://a.b.c.d:port
Your no_proxy? [] localhost, 127.0.0.1, 172.21.0.0

If your proxy is an authenticating proxy, you can store your username permanently. If you do not want that, just press RETURN. You will then be asked for your username in every future session.

Your proxy user id? []

Please remember to call 'o conf commit' to make the config permanent!

cpan[3]> o conf commit
commit: wrote 'xxx/xxx/xxx/xxxxx/xxxx/Config.pm'
vim /root/.cpan/CPAN/MyConfig.pm
$CPAN::Config = {
 'applypatch' => q[],
 'auto_commit' => q[0],
 'build_cache' => q[100],
 'build_dir' => q[/root/.cpan/build],
 'build_dir_reuse' => q[0],
 'build_requires_install_policy' => q[yes],
 'bzip2' => q[/bin/bzip2],
 'cache_metadata' => q[1],
 'check_sigs' => q[0],
 'colorize_output' => q[0],
 'commandnumber_in_prompt' => q[1],
 'connect_to_internet_ok' => q[1],
 'cpan_home' => q[/root/.cpan],
 'ftp_passive' => q[1],
 'ftp_proxy' => q[],
 'getcwd' => q[cwd],
 'gpg' => q[/usr/bin/gpg],
 'gzip' => q[/bin/gzip],
 'halt_on_failure' => q[0],
 'histfile' => q[/root/.cpan/histfile],
 'histsize' => q[100],
 'http_proxy' => q[1],
 'inactivity_timeout' => q[0],
 'index_expire' => q[1],
 'inhibit_startup_message' => q[0],
 'keep_source_where' => q[/root/.cpan/sources],
 'load_module_verbosity' => q[none],
 'make' => q[/usr/bin/make],
 'make_arg' => q[],
 'make_install_arg' => q[],
 'make_install_make_command' => q[/usr/bin/make],
 'makepl_arg' => q[INSTALLDIRS=site],
 'mbuild_arg' => q[],
 'mbuild_install_arg' => q[],
 'mbuild_install_build_command' => q[./Build],
 'mbuildpl_arg' => q[--installdirs site],
 'no_proxy' => q[localhost, 127.0.0.1, 172.21.0.0],
 'pager' => q[/usr/bin/less],
 'patch' => q[/usr/bin/patch],
 'perl5lib_verbosity' => q[none],
 'prefer_external_tar' => q[1],
 'prefer_installer' => q[MB],
 'prefs_dir' => q[/root/.cpan/prefs],
 'prerequisites_policy' => q[follow],
 'proxy_pass' => q[],
 'proxy_user' => q[],
 'scan_cache' => q[atstart],
 'shell' => q[/bin/bash],
 'show_unparsable_versions' => q[0],
 'show_upload_date' => q[0],
 'show_zero_versions' => q[0],
 'tar' => q[/bin/tar],
 'tar_verbosity' => q[none],
 'term_is_latin' => q[1],
 'term_ornaments' => q[1],
 'test_report' => q[0],
 'trust_test_report_history' => q[0],
 'unzip' => q[/usr/bin/unzip],
 'urllist' => [q[2]],
 'use_sqlite' => q[0],
 'version_timeout' => q[15],
 'wget' => q[/usr/bin/wget],
 'yaml_load_code' => q[0],
 'yaml_module' => q[YAML],
};
1;
__END__
Outils personnels