Perl/en: Difference between revisions

Jump to navigation Jump to search
Updating to match new version of source page
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 26: Line 26:
Would you like me to configure as much as possible automatically? [yes]
Would you like me to configure as much as possible automatically? [yes]
...
...
What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
[local::lib]
...
</nowiki>
</nowiki>
}}
}}
Afterwards, use the following commands to change your installation directory:
The <tt>cpan</tt> utility will offer to append a variety of environment variable settings to your .bashrc file, which you should agree to. You can then type the command <tt>quit</tt> at the interface to exit the <tt>cpan</tt> software. Before installing any Perl modules you will need to restart your shell for these new settings to take effect.
{{
Commands
|prompt=>
|o conf mbuildpl_arg "--install_base ~/perl/"
|o conf makepl_arg "PREFIX{{=}}~/perl/"
|o conf commit
|exit
}}
''Note that it is important to quit <tt>cpan</tt> at this stage and to restart it so that the new settings are used.''


=== Package Installation ===
=== Package Installation ===
Line 46: Line 41:
|result=
|result=
<nowiki>
<nowiki>
cpan shell -- CPAN exploration and modules installation (v1.7602)
Terminal does not support AddHistory.
ReadLine support available (try 'install Bundle::CPAN')


cpan> install PerlIO::gzip
cpan shell -- CPAN exploration and modules installation (v2.11)
Enter 'h' for help.
</nowiki>
cpan[1]> install Chess
<nowiki>
...
...
Running install for module PerlIO::gzip
Running install for module 'Chess'
Running make for N/NW/NWCLARK/PerlIO-gzip-0.18.tar.gz
Fetching with LWP:
Fetching with LWP:
  ftp://CPAN.mirror.rafal.ca/pub/CPAN/authors/id/N/NW/NWCLARK/PerlIO-gzip-0.18.tar.gz
http://www.cpan.org/authors/id/B/BJ/BJR/Chess-0.6.2.tar.gz
CPAN: Digest::MD5 loaded ok
Fetching with LWP:
Fetching with LWP:
  ftp://CPAN.mirror.rafal.ca/pub/CPAN/authors/id/N/NW/NWCLARK/CHECKSUMS
http://www.cpan.org/authors/id/B/BJ/BJR/CHECKSUMS
...
Checksum for /home/stubbsda/.cpan/sources/authors/id/B/BJ/BJR/Chess-0.6.2.tar.gz ok
 
Scanning cache /home/stubbsda/.cpan/build for sizes
CPAN.pm: Going to build N/NW/NWCLARK/PerlIO-gzip-0.18.tar.gz
............................................................................DONE
 
'YAML' not installed, will not store persistent state
Configuring B/BJ/BJR/Chess-0.6.2.tar.gz with Makefile.PL
Checking if your kit is complete...
Checking if your kit is complete...
Looks good
Looks good
Writing Makefile for PerlIO::gzip
...
Running make for B/BJ/BJR/Chess-0.6.2.tar.gz
...
...
Running make test
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
PERL_DL_NONLAZY=1 "/cvmfs/soft.computecanada.ca/nix/store/g8ds64pbnavscf7n754pjlx5cp1mkkv1-perl-5.22.2/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/read.....ok
t/bishop.t ......... ok 
t/write....ok
t/board.t .......... ok    
t/checkmate.t ...... ok 
t/game.t ........... ok     
t/king.t ........... ok 
t/knight.t ......... ok   
t/movelist.t ....... ok   
t/movelistentry.t .. ok   
t/pawn.t ........... ok   
t/piece.t .......... ok   
t/queen.t .......... ok 
t/rook.t ........... ok 
t/stalemate.t ...... ok  
All tests successful.
All tests successful.
Files=2, Tests=5610 wallclock secs ( 0.37 cusr + 0.05 csys =  0.42 CPU)
Files=13, Tests=3113 wallclock secs ( 0.14 usr  0.05 sys +  2.49 cusr  0.20 csys =  2.88 CPU)
Result: PASS
...
...
Running make install
Installing /home/stubbsda/perl5/man/man3/Chess::Piece::Knight.3
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /home/stubbsda/perl5/man/man3/Chess.3
Installing /home/stubbsda/perl5/man/man3/Chess::Piece::Bishop.3
Installing /home/stubbsda/perl5/man/man3/Chess::Board.3
Appending installation info to /home/stubbsda/perl5/lib/perl5/x86_64-linux-thread-multi/perllocal.pod
  BJR/Chess-0.6.2.tar.gz
  /cvmfs/soft.computecanada.ca/nix/var/nix/profiles/16.09/bin/make install  -- OK
</nowiki>
cpan[2]>
<nowiki>
</nowiki>
</nowiki>
}}
Lastly, you must add the path of your installation directory to your environment. You can do this by adding the following line to your <tt>.bashrc</tt>:
{{
Command|export PERL5LIB{{=}}$HOME/perl/lib64/perl5:$HOME/perl/share/perl5
}}
(assuming that you have installed the packages in the directory <tt>$HOME/perl</tt>).
=== Using the Local::Lib Package to Install Packages ===
An alternative approach, based on the Perl package local::lib, is the following - you can simply copy and paste the commands into your terminal for it to work.
{{
File
  |name=perl_library.sh
  |lang=bash
  |contents=
# install local::lib
wget http://search.cpan.org/CPAN/authors/id/H/HA/HAARG/local-lib-2.000018.tar.gz
tar -xzf local-lib-2.000018.tar.gz
cd local-lib-2.000018
perl Makefile.PL --bootstrap
make test && make install
# setting up appropriate environment variables so that perl knows about our new ~/perl5/lib directory
cd ~               
echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >> ~/.bashrc
source ~/.bashrc
# check that local::lib is indeed installing to the right directory, you should see a bunch of paths beginning with ~/perl5/lib/perl5/ get printed out
perl -e 'print "@INC"'
}}
}}
38,897

edits

Navigation menu