Perl
From SkyWiki
Line 1: | Line 1: | ||
+ | =User-lokale Perl-Installation= | ||
+ | |||
[http://perlmeister.com/snapshots/199911/index.html#da_hab__ich_dann_was_eigenes__linuxmagazin__november_1999_ locally install Perl]: | [http://perlmeister.com/snapshots/199911/index.html#da_hab__ich_dann_was_eigenes__linuxmagazin__november_1999_ locally install Perl]: | ||
Line 12: | Line 14: | ||
in .profile, .bashrc o.ä.: | in .profile, .bashrc o.ä.: | ||
export PATH=$HOME/bin:$PATH | export PATH=$HOME/bin:$PATH | ||
+ | |||
+ | |||
+ | =User-lokale Perl-Packages= | ||
+ | |||
+ | [http://www.dcc.fc.up.pt/~pbrandao/aulas/0203/AR/modules_inst_cpan.html user CPAN installation] | ||
+ | |||
+ | Create a directory for the perl modules in your HOME | ||
+ | |||
+ | $ mkdir ~/perl5libCreate ~/.cpan and ~/.cpan/CPAN directories: | ||
+ | |||
+ | $ mkdir ~/.cpan $ mkdir ~/.cpan/CPANCreate a Config.pm for the CPAN module with $CPAN::Config empty | ||
+ | |||
+ | $ echo "\$CPAN::Config = {}"> ~/.cpan/CPAN/MyConfig.pmExecute again: | ||
+ | |||
+ | $ perl -MCPAN -e shellThis time (if all goes well) it will prompt you for the empty fields in $CPAN::Config. | ||
+ | |||
+ | |||
+ | It is OK to accept the default values until it asks you for the parameters for the Makefile.pl | ||
+ | Parameters for the 'perl Makefile.PL' command? Typical frequently used settings: POLLUTE=1 increasing backwards compatibility LIB=~/perl non-root users (please see manual for more hints)You should then answer with the following line: | ||
+ | |||
+ | PREFIX=~/perl5lib/ LIB=~/perl5lib/lib INSTALLMAN1DIR=~/perl5lib/man1 INSTALLMAN3DIR=~/perl5lib/man3This will add the parameters for your user Makefile. | ||
+ | This will enable installations of Modules (.pm) and compile code (.so) in ~/perl5lib/ (more accurately in a subdirectory named after the architecture of your machine). Files for the manual of the modules will also be installled in the specified directories. | ||
+ | |||
+ | |||
+ | Finish the CPAN configuration by answering all other questions (ex.: http_proxy?http://your_proxy.yourdomain). | ||
+ | Set the environment variables for the perl lib path and the manpath. Using bash you should do something like | ||
+ | |||
+ | export PERL5LIB=${PERL5LIB}:~/perl5lib export MANPATH=~/perl5libYou should add the environment variable settings to your profile file (in bash ~/.bash_profile) | ||
+ | |||
+ | |||
+ | =Package-Installation= | ||
CPAN-Aufruf: | CPAN-Aufruf: |
Revision as of 09:44, 14 March 2009
Contents |
User-lokale Perl-Installation
./Configure -d -D prefix=$HOME make make install
-> in Perl-Scripts eintragen:
#!home/mike/bin/perl -w
in .profile, .bashrc o.ä.:
export PATH=$HOME/bin:$PATH
User-lokale Perl-Packages
Create a directory for the perl modules in your HOME
$ mkdir ~/perl5libCreate ~/.cpan and ~/.cpan/CPAN directories:
$ mkdir ~/.cpan $ mkdir ~/.cpan/CPANCreate a Config.pm for the CPAN module with $CPAN::Config empty
$ echo "\$CPAN::Config = {}"> ~/.cpan/CPAN/MyConfig.pmExecute again:
$ perl -MCPAN -e shellThis time (if all goes well) it will prompt you for the empty fields in $CPAN::Config.
It is OK to accept the default values until it asks you for the parameters for the Makefile.pl
Parameters for the 'perl Makefile.PL' command? Typical frequently used settings: POLLUTE=1 increasing backwards compatibility LIB=~/perl non-root users (please see manual for more hints)You should then answer with the following line:
PREFIX=~/perl5lib/ LIB=~/perl5lib/lib INSTALLMAN1DIR=~/perl5lib/man1 INSTALLMAN3DIR=~/perl5lib/man3This will add the parameters for your user Makefile.
This will enable installations of Modules (.pm) and compile code (.so) in ~/perl5lib/ (more accurately in a subdirectory named after the architecture of your machine). Files for the manual of the modules will also be installled in the specified directories.
Finish the CPAN configuration by answering all other questions (ex.: http_proxy?http://your_proxy.yourdomain).
Set the environment variables for the perl lib path and the manpath. Using bash you should do something like
export PERL5LIB=${PERL5LIB}:~/perl5lib export MANPATH=~/perl5libYou should add the environment variable settings to your profile file (in bash ~/.bash_profile)
Package-Installation
CPAN-Aufruf:
perl -MCPAN -eshell
CPAN-Initialisierung:
install Bundle::libnet install Bundle::CPAN install MD5 install Bundle::LWP install HTML::Parser install HTML::Tree install Archive::Tar install GD
Perl syntax
read a file line by line
open(IN, '<'.$ARGV[0]); foreach(<IN>) { chomp; print $_, "\n"; } close(IN);