perlrc - run perlrc file before script
$ perl -Mperlrc script.pl $ perl -Mperlrc=/path1:/path2:...
This module executes a perlrc file containing perl code before calling the main script.
By default it looks for the perlrc file in the following locations:
~/.perlrc ~/.perlrc.pl /etc/perlrc /etc/perlrc.pl
Alternatively, a list of directories and/or files can be passed to the module. For instance:
$ perl -Mperlrc=~root/:/tmp/myperlrc
Then the module would look for the perlrc file in
~root/.perlrc ~root/.perlrc.pl /tmp/myperlrc # asumming /tmp/myperlrc is not a directory /tmp/myperlrc.pl
Some cases where this module may be handy are:
"-f" in perlrun, Begin
At the moment, it only works on Unix systems.
Feel free to fork and send me a pull request with the modifications required to make it work under Windows or any other operating systems.
The code is at GitHub: https://github.com/salva/p5-perlrc.
Salvador Fandiño, <sfandino@yahoo.com>
Copyright (C) 2011 by Qindel Formación y Servicios S.L.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.
To install perlrc, copy and paste the appropriate command in to your terminal.
cpanm
cpanm perlrc
CPAN shell
perl -MCPAN -e shell install perlrc
For more information on module installation, please visit the detailed CPAN module installation guide.