develooper Front page | perl.perl5.porters | Postings from October 1999

Re: PERL_HEADER env varb: was: Addition to @INC

From:
Ed Peschko
Date:
October 21, 1999 12:50
Subject:
Re: PERL_HEADER env varb: was: Addition to @INC
Message ID:
199910211947.OAA14000@foghorn.csgsystems.com
On Thu, Oct 21, 1999 at 11:36:42AM -0700, Chip Salzenberg wrote:
>According to Moore, Paul:
>> Site.pm
>> -------
>> use strict;
>
>That will have no effect on the main program.
>
>> use DBI;
>> use FindBin;           
>> use lib $FindBin::Bin; 
>> use IO;
>> use Data::Dumper;
>> use Rebol;
>
>These will import their functions into %main::, which may or may
>not be the Right Thing.
>
>> use lib "put site specific libraries here"; 
>
>This will work, though.

Well, come to think of it, the PERL5OPT variable will not do exactly 
what I have in mind either, neither will '-Mstrict', etc.
Suppose you want to export a certain module everywhere, so it is 
visible to each scope. (Dumper, strict, whatever). What would really
be necessary is having these 'use' statements attached to each 'package'
statement.

I suppose you could make a module, 'use Defaults' and make it run at
INIT time which takes all of the namespaces, and manually does a bunch
of 

foreach $namespace (@namespaces)
{
	package $namespace;
	eval ("$ENV{PERL5OPT}");
}

but that is incomplete, error prone, and doesn't work for certain
modules/pragmas (use strict comes to mind). And exactly how do you
get a list of namespaces anyways (closest I can think of is via @INC)?

Ed



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About