Table des matières
Notes Perl
Voir aussi : Raku
Voir :
Variables PATH
PERL5LIB
$ env -i perl -V ... @INC: /usr/lib/perl5/site_perl/5.18.0/x86_64-linux-thread-multi-ld /usr/lib/perl5/site_perl/5.18.0 /usr/lib/perl5/5.18.0/x86_64-linux-thread-multi-ld /usr/lib/perl5/5.18.0 .
PATH="/home/jean/perl5/bin${PATH:+:${PATH}}"; export PATH; PERL5LIB="/home/jean/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; PERL_LOCAL_LIB_ROOT="/home/jean/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; PERL_MB_OPT="--install_base \"/home/jean/perl5\""; export PERL_MB_OPT; PERL_MM_OPT="INSTALL_BASE=/home/jean/perl5"; export PERL_MM_OPT;
CPAN
Installer un module
cpan JSON
Installer un module téléchargé localement
tar xzvf JSON-4.10.tar.gz cd JSON-4.10/ perl Makefile.PL PREFIX=~ make test make install
code-style-guidelines (exemple)
Code Style Guidelines Introduction
Perl code from Pull-request must conform to the following style guidelines. If you find any code which doesn't conform, please fix it.
1 Indentation
Space should be used to indent all code blocks. Tabs should never be used to indent code blocks. Mixing tabs and spaces results in misaligned code blocks for other developers who prefer different indentation settings. Please use 4 for indentation space width.
if ($1 > 1) { ....return 1; } else { if ($i == -1) { ....return 0; } return -1 }
2 Comments
There should always be at least 1 space between the # character and the beginning of the comment. This makes it a little easier to read multi-line comments:
# Good comment #Wrong comment
3 Subroutine & Variable Names
Whenever possible, use underscore to seperate words and don't use uppercase characters:
sub get_logs {} my $start_time;
Keys of hash table should use alphanumeric and underscore characters only (and no quote!):
$dogs->{meapolitan_mastiff} = 10;
4 Curly Brackets, Parenthesis
There should be a space between every control/loop keyword and the opening parenthesis:
if ($i == 1) { ... } while ($i == 2) { ... }
5 If/Else Statements
'else', 'elsif' should be on the same line after the previous closing curly brace:
if ($i == 1) { ... } else { ... }
You can use single line if conditional:
next if ($i == 1);
Suite
libraries Strict and warnings are mandatory
use strict; use warnings;
Autres
use feature bitwise;
