Difference between revisions of "Perl"
Moskalenko (talk | contribs) m (Text replace - "|{{#vardefine:intel|}} <!-- E.g. "11.1" --> |{{#vardefine:mpi|}} <!-- E.g. "openmpi/1.3.4" -->" to "") |
|||
(14 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
__NOEDITSECTION__ | __NOEDITSECTION__ | ||
− | [[Category:Software]][[Category: | + | [[Category:Software]][[Category:Language]][[Category:Programming]] |
− | + | {|<!--Main settings - REQUIRED--> | |
− | {| | ||
− | <!--Main settings - REQUIRED--> | ||
|{{#vardefine:app|perl}} | |{{#vardefine:app|perl}} | ||
|{{#vardefine:url|http://www.perl.org/}} | |{{#vardefine:url|http://www.perl.org/}} | ||
− | + | |{{#vardefine:exe|1}} <!--Present manual instructions for running the software --> | |
− | |||
− | |||
− | |{{#vardefine:exe|}} <!--Present manual instructions for running the software --> | ||
|{{#vardefine:conf|}} <!--Enable config wiki page link - {{#vardefine:conf|1}} = ON/conf|}} = OFF--> | |{{#vardefine:conf|}} <!--Enable config wiki page link - {{#vardefine:conf|1}} = ON/conf|}} = OFF--> | ||
|{{#vardefine:pbs|}} <!--Enable PBS script wiki page link--> | |{{#vardefine:pbs|}} <!--Enable PBS script wiki page link--> | ||
Line 25: | Line 20: | ||
Perl 5 is a highly capable, feature-rich programming language with over 23 years of development. | Perl 5 is a highly capable, feature-rich programming language with over 23 years of development. | ||
<!--Modules--> | <!--Modules--> | ||
− | == | + | ==Environment Modules== |
− | + | Run <code>module spider {{#var:app}}</code> to find out what environment modules are available for this application. | |
− | |||
− | |||
==System Variables== | ==System Variables== | ||
− | * HPC_{{ | + | * HPC_{{uc:{{#var:app}}}}_DIR - installation directory |
* PERL5LIB - perl module path | * PERL5LIB - perl module path | ||
<!--Additional--> | <!--Additional--> | ||
{{#if: {{#var: exe}}|==Additional Information== | {{#if: {{#var: exe}}|==Additional Information== | ||
− | + | ||
+ | Though modern-day Linux and Unix systems may have many perl modules already installed, the time may come when you use a module that was not shipped with your system or installed by your administrator. Don't fret - you can do this all by yourself by using the CPAN module. This document will describe how to use the CPAN module to install perl modules into a subdirectory of your home area which we'll call <code>perl5lib</code>. | ||
+ | |||
+ | '''Note: If you are using the ''perl'' module by running ''module load perl'' you can request installation of additional modules by filing a [http://support.rc.ufl.edu support request].''' | ||
+ | |||
+ | ===CPAN Module Configuration=== | ||
+ | |||
+ | #Execute the following command to start a CPAN shell: | ||
+ | #*<pre>$ perl -MCPAN -e shell</pre> | ||
+ | #The first time you run this, an interactive question and answer session will be started as CPAN configures itself. You can take all the defaults until it asks whether you want any parameters for perl Makefile.PL: | ||
+ | #*<pre>Every Makefile.PL is run by perl in a separate process.</pre> | ||
+ | #*<pre>...</pre> | ||
+ | #*<pre>Your choice: []</pre> | ||
+ | #You should answer with the following long line: | ||
+ | #*<pre>PREFIX=~/perl5lib/ LIB=~/perl5lib/lib INSTALLMAN1DIR=~/perl5lib/man1 INSTALLMAN3DIR=~/perl5lib/man3</pre> | ||
+ | #You can take defaults again until it comes time to choose mirrors of www.cpan.org from which you can install from. Choose as many as you like; I chose: | ||
+ | #*<pre>ftp://mirrors.kernel.org/pub/CPAN/</pre> | ||
+ | #*<pre>http://www.perl.com/CPAN/</pre> | ||
+ | #After choosing your mirrors, press enter until you get the <code>cpan></code> prompt. Then quit (type '<code>q</code>'). | ||
+ | #Now tell perl to use your personal module repository by setting the <code>PERL5LIB</code> environment variable. For Bourne shell users, you would do this: | ||
+ | #*<pre>$ PERL5LIB=~/perl5lib/lib</pre> | ||
+ | #*<pre>$ export PERL5LIB</pre> | ||
+ | #You should also add the above two lines to your <code>~/.bash_profile</code> so the <code>PERL5LIB</code> variable will be automatically set when you next log in. | ||
+ | #Then start up CPAN again: | ||
+ | #*<pre>$ perl -MCPAN -e shell</pre> | ||
+ | #You will be immediately greeted with the <code>cpan></code> prompt. At the <code>cpan></code> prompt, enter the following to get CPAN to update itself: | ||
+ | #*<pre>install Bundle::CPAN</pre> | ||
+ | #*<pre>reload cpan</pre> | ||
+ | and that's it! | ||
+ | |||
+ | ===Installing Additional Modules=== | ||
+ | |||
+ | Now that you have CPAN configured, you can install all the modules you want either from CPAN's interactive shell (<code>perl -MCPAN -e shell</code>) or from the command line (<code>perl -MCPAN -e 'install FOO::BAR'</code>). The modules will be installed into your <code>~/perl5lib/lib</code> directory. | ||
+ | <div class="mw-collapsible mw-collapsed" style="width:70%; padding: 5px; border: 1px solid gray;"> | ||
+ | ''Expand this section to view example of module installation.'' | ||
+ | <div class="mw-collapsible-content" style="padding: 5px;"> | ||
+ | As a full example, we'll install the <code>File::Slurp</code> module into the username <code>user</code>'s <code>~/perl5lib</code> directory. | ||
+ | |||
+ | <pre> | ||
+ | [user@submit2 ~]$ perl -MCPAN -e shell | ||
+ | |||
+ | cpan shell -- CPAN exploration and modules installation (v1.7602) | ||
+ | ReadLine support enabled | ||
+ | |||
+ | cpan> install File::Slurp | ||
+ | CPAN: Storable loaded ok | ||
+ | ... | ||
+ | ... | ||
+ | ... | ||
+ | /usr/bin/make install -j2 -- OK | ||
+ | cpan> | ||
+ | </pre> | ||
+ | |||
+ | With installation finished, we can test it interactively: | ||
+ | |||
+ | <pre> | ||
+ | [user@submit2 ~]$ perl -e 'use File::Slurp;' | ||
+ | </pre> | ||
+ | |||
+ | If all went well, the above command will return with no errors. | ||
+ | </div></div>|}} | ||
{{#if: {{#var: conf}}|==Configuration== | {{#if: {{#var: conf}}|==Configuration== | ||
See the [[{{PAGENAME}}_Configuration]] page for {{#var: app}} configuration details.|}} | See the [[{{PAGENAME}}_Configuration]] page for {{#var: app}} configuration details.|}} |
Latest revision as of 17:56, 2 January 2023
Description
Perl 5 is a highly capable, feature-rich programming language with over 23 years of development.
Environment Modules
Run module spider perl
to find out what environment modules are available for this application.
System Variables
- HPC_PERL_DIR - installation directory
- PERL5LIB - perl module path
Additional Information
Though modern-day Linux and Unix systems may have many perl modules already installed, the time may come when you use a module that was not shipped with your system or installed by your administrator. Don't fret - you can do this all by yourself by using the CPAN module. This document will describe how to use the CPAN module to install perl modules into a subdirectory of your home area which we'll call perl5lib
.
Note: If you are using the perl module by running module load perl you can request installation of additional modules by filing a support request.
CPAN Module Configuration
- Execute the following command to start a CPAN shell:
$ perl -MCPAN -e shell
- The first time you run this, an interactive question and answer session will be started as CPAN configures itself. You can take all the defaults until it asks whether you want any parameters for perl Makefile.PL:
Every Makefile.PL is run by perl in a separate process.
...
Your choice: []
- You should answer with the following long line:
PREFIX=~/perl5lib/ LIB=~/perl5lib/lib INSTALLMAN1DIR=~/perl5lib/man1 INSTALLMAN3DIR=~/perl5lib/man3
- You can take defaults again until it comes time to choose mirrors of www.cpan.org from which you can install from. Choose as many as you like; I chose:
ftp://mirrors.kernel.org/pub/CPAN/
http://www.perl.com/CPAN/
- After choosing your mirrors, press enter until you get the
cpan>
prompt. Then quit (type 'q
'). - Now tell perl to use your personal module repository by setting the
PERL5LIB
environment variable. For Bourne shell users, you would do this:$ PERL5LIB=~/perl5lib/lib
$ export PERL5LIB
- You should also add the above two lines to your
~/.bash_profile
so thePERL5LIB
variable will be automatically set when you next log in. - Then start up CPAN again:
$ perl -MCPAN -e shell
- You will be immediately greeted with the
cpan>
prompt. At thecpan>
prompt, enter the following to get CPAN to update itself:install Bundle::CPAN
reload cpan
and that's it!
Installing Additional Modules
Now that you have CPAN configured, you can install all the modules you want either from CPAN's interactive shell (perl -MCPAN -e shell
) or from the command line (perl -MCPAN -e 'install FOO::BAR'
). The modules will be installed into your ~/perl5lib/lib
directory.
Expand this section to view example of module installation.
As a full example, we'll install the File::Slurp
module into the username user
's ~/perl5lib
directory.
[user@submit2 ~]$ perl -MCPAN -e shell cpan shell -- CPAN exploration and modules installation (v1.7602) ReadLine support enabled cpan> install File::Slurp CPAN: Storable loaded ok ... ... ... /usr/bin/make install -j2 -- OK cpan>
With installation finished, we can test it interactively:
[user@submit2 ~]$ perl -e 'use File::Slurp;'
If all went well, the above command will return with no errors.