The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

perlrc - run perlrc file before script

SYNOPSIS

  $ perl -Mperlrc script.pl
  $ perl -Mperlrc=/path1:/path2:...

DESCRIPTION

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:

modify @INC to include some paths
mock your development environment to mimic the one in production
load modules and define constants accesible from one-liners
etc.

SEE ALSO

"-f" in perlrun, Begin

BUGS

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.

AUTHOR

Salvador Fandiño, <sfandino@yahoo.com>

COPYRIGHT AND LICENSE

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.