Bureaucrats, cc_docs_admin, cc_staff
2,314
edits
No edit summary |
(Marked this version for translation) |
||
Line 1: | Line 1: | ||
<languages /> | <languages /> | ||
<translate> | <translate> | ||
== Description == | == Description == <!--T:1--> | ||
[http://www.perl.org Perl] is a free programming language which is interpreted and has acquired a vast library of contributed packages over the 25+ years of its existence. Its strengths are manipulating strings, database access and its portability ([http://www.cio.com/article/175450/You_Used_Perl_to_Write_WHAT_ according to this article]). Its weaknesses are its poor performance and the ease with which one can write obscure and illegible code. By design, Perl offers several different ways of accomplishing the same task. Many programmers have adopted this language and write code that is very compact but difficult to decipher. | [http://www.perl.org Perl] is a free programming language which is interpreted and has acquired a vast library of contributed packages over the 25+ years of its existence. Its strengths are manipulating strings, database access and its portability ([http://www.cio.com/article/175450/You_Used_Perl_to_Write_WHAT_ according to this article]). Its weaknesses are its poor performance and the ease with which one can write obscure and illegible code. By design, Perl offers several different ways of accomplishing the same task. Many programmers have adopted this language and write code that is very compact but difficult to decipher. | ||
== Loading the Interpreter == | == Loading the Interpreter == <!--T:2--> | ||
The Perl language is made available on Compute Canada's servers using a module which you can load like any other, e.g. | The Perl language is made available on Compute Canada's servers using a module which you can load like any other, e.g. | ||
{{Command|module avail perl}} | {{Command|module avail perl}} | ||
Line 11: | Line 11: | ||
to load a particular version. | to load a particular version. | ||
== Installing Packages == | == Installing Packages == <!--T:3--> | ||
A large number of Perl packages can be installed by means of the [http://www.cpan.org/ Comprehensive Perl Archive Network], by using the tool <tt>cpan</tt>, which however must first be initialized correctly in | A large number of Perl packages can be installed by means of the [http://www.cpan.org/ Comprehensive Perl Archive Network], by using the tool <tt>cpan</tt>, which however must first be initialized correctly in | ||
order to install them in your home directory. | order to install them in your home directory. | ||
=== Initial Configuration for Package Installation === | === Initial Configuration for Package Installation === <!--T:4--> | ||
During the first execution of the command <tt>cpan</tt> the utility will ask you if you want to allow it to configure the majority of settings automatically. Respond <tt>yes</tt>. | During the first execution of the command <tt>cpan</tt> the utility will ask you if you want to allow it to configure the majority of settings automatically. Respond <tt>yes</tt>. | ||
{{ | {{ | ||
Line 24: | Line 24: | ||
... | ... | ||
<!--T:5--> | |||
Would you like me to configure as much as possible automatically? [yes] | Would you like me to configure as much as possible automatically? [yes] | ||
... | ... | ||
Line 39: | Line 40: | ||
''Note that it is important to quit <tt>cpan</tt> at this stage and to restart it so that the new settings are used.'' | ''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 === <!--T:6--> | ||
When the initial configuration is done, you can install any of the more than 25,000 packages available on CPAN. For example: | When the initial configuration is done, you can install any of the more than 25,000 packages available on CPAN. For example: | ||
{{ | {{ | ||
Line 49: | Line 50: | ||
ReadLine support available (try 'install Bundle::CPAN') | ReadLine support available (try 'install Bundle::CPAN') | ||
<!--T:7--> | |||
cpan> install PerlIO::gzip | cpan> install PerlIO::gzip | ||
... | ... | ||
Line 60: | Line 62: | ||
... | ... | ||
<!--T:8--> | |||
CPAN.pm: Going to build N/NW/NWCLARK/PerlIO-gzip-0.18.tar.gz | CPAN.pm: Going to build N/NW/NWCLARK/PerlIO-gzip-0.18.tar.gz | ||
<!--T:9--> | |||
Checking if your kit is complete... | Checking if your kit is complete... | ||
Looks good | Looks good | ||
Line 78: | Line 82: | ||
}} | }} | ||
<!--T:10--> | |||
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>: | 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>: | ||
{{ | {{ | ||
Line 84: | Line 89: | ||
(assuming that you have installed the packages in the directory <tt>$HOME/perl</tt>). | (assuming that you have installed the packages in the directory <tt>$HOME/perl</tt>). | ||
=== Using the Local::Lib Package to Install Packages === | === Using the Local::Lib Package to Install Packages === <!--T:11--> | ||
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. | 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. | ||
{{ | {{ | ||
Line 98: | Line 103: | ||
make test && make install | make test && make install | ||
<!--T:12--> | |||
# setting up appropriate environment variables so that perl knows about our new ~/perl5/lib directory | # setting up appropriate environment variables so that perl knows about our new ~/perl5/lib directory | ||
cd ~ | cd ~ | ||
Line 103: | Line 109: | ||
source ~/.bashrc | source ~/.bashrc | ||
<!--T:13--> | |||
# 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 | # 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"' | perl -e 'print "@INC"' | ||
}} | }} | ||
</translate> | </translate> |