This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Perl resource configuration =head1 VERSION Maintainer: Jonathan Scott Duff <[EMAIL PROTECTED]> Date: 16 Aug 2000 Last-Modified: 1 Sep 2000 Mailing List: [EMAIL PROTECTED] Version: 2 Number: 114 Status: Developing =head1 ABSTRACT Perl should provide a mechanism to have code automatically loaded from a file upon interpreter startup. =head1 DESCRIPTION Many programs have so-called "resource configuration" files (at least that's what I call them) that are loaded and executed upon program startup. Some example programs that have this ability include bash, mutt, and python. Perl should do something similar. The first version of this RFC proposed two "rc" files: C</etc/perlrc> and C<~/.perlrc> [1]. However, the author of this RFC has decided that the motivations behind C</etc/perlrc> are misguided. If the administrator of the system wishes to impose global behavior, he can and should do so through the environment. This RFC now proposes that Perl 6 support a single per-user "rc" file, C<~/.perlrc>, that is loaded for each Perl program run by the user. This file would simply be Perl code that is loaded and executed just as if the following were at the top of each perl program executed by the user: BEGIN { $_ = "$ENV{HOME}/.perlrc"; require if -e; } Execution of the C<~/.perlrc> would not be the default behavior. A command line switch would be needed to invoke the automatic loading. For example: #!/usr/bin/perl -r # ~/.perlrc is now loaded Thus the C<~/.perlrc> file could be used by the user to setup common defaults such as diagnostics or stricture for all of his/her programs. Also, if RFC 184 (interactive mode for perl) is adopted, it may be desirable to automatically execute the contents of C<~/.perlrc> upon entered an interactive session regardless of whether or not the command line switch that triggers loading of C<~/.perlrc> was used. Nathan Wiger <[EMAIL PROTECTED]> brought up the issue of packaging a perl program and/or module that may rely on settings in the local C<~/.perlrc> which could be radically different from the settings in the C<~/.perlrc> on the client's side. It is suggested that a warning be emitted (if warnings are turned on) when the programmer uses the command line option to the the "rc file". How do the other programming languages that have an "rc file" concept handle this problem (e.g., python)? =head1 IMPLEMENTATION An option would need to be added to explicitly make perl look for the C<~/.perlrc> file. The author of this RFC tentatively suggests C<-r>. =head1 MIGRATION Only those programs that wish to take advantage of this feature need translating from Perl5. This is best left to the programmer rather than an automated translator. =head1 NOTES [1] Note that this RFC is couched in terms of a Unix-ish filesystem. Perl should support the analogous concept for the other platforms on which it compiles. =head1 REFERENCES Perl 5.6.0 Documentation >From the man page for python 1.6 bash documentation: http://www.gnu.org/manual/bash/html_chapter/bashref_5.html#SEC61 The mutt man page: http://www.mutt.org/doc/man_page.html RFC 184: Perl should support an interactive mode: http://www.mail-archive.com/[email protected]/msg02493.html
