...
Code which will be distributed to others not of our group, should be formatted under the recommended perl formatting specifications as defined in Perl Style Guide.
Version of Perl to use
There are two main versions of perl at SLAC. They are invoked by #!/usr/local/bin/perl and #!/usr/bin/per, #!/usr/localbin/perl is maintained centrally and is sharted by AFS. It is the most up to date with all the appropriate shared libraries. #!/usr/bin/perl is a local copy on each host. It is typically an older version of perl and does not always (depends on host) contain all the shared libraries (e.g. the RRD or mysql libraries). We (IEPM group) are committed to to keeping #!/usr/bin/perl reasonably up to date and with the necesssary shared libraries on iepm-bw, iepm-resp and pinger hosts.
For scripts that will need exporting to other sites use:
Code Block |
---|
#!/usr/bin/perl -w
|
For scripts that will only run at SLAC use
Code Block |
---|
#!/usr/local/bin/perl -w
|
If you are writing CGI scripts then make sure you add the -T taint option.
Do NOT use #!/bin/env perl -T for CGI scripts, it does not work.
PerlTidy
To ease formatting and translations of the various coding styles available, it is recommended that the tool PerlTidy should be used to (re)format code to the format desired.
...
PerlTidy is available on all AFS enabled machines at SLAC. The basic syntax is
No Format |
---|
perltidy [ options ] file1 file2 file3 ...
perltidy [ options ] file1 -o outfile
perltidy [ options ] file1 -st >outfile
perltidy [ options ] outfile
|
...