in reply to supress an error
2.) In the earlier code sample, COMMON::AUTH is designed to be used as a module (with use or require). You might want to rethink your design. Why put "global" variables into a perl (.pl) file? Why not just define them in every script; or better yet, make small subs in your COMMON::AUTH module that return specific data. For example:package COMMON::AUTH; use strict; use Exporter; @COMMON::AUTH::ISA = qw(Exporter); our ($user,$admin); @EXPORT = qw($user $admin); $user = $ENV{'REMOTE_USER'}; $admin = 'admin'; 1;
The cool thing about using subs to return this (fairly trivial) data is that you can do some other processing (for example, untainting) before you return.package COMMON::AUTH; use strict; use Exporter; @COMMON::AUTH::ISA = qw(Exporter); @EXPORT = qw(user admin); sub user { return $ENV{'REMOTE_USER'}; #Make sure to untaint this data just i +n case } sub admin { return 'admin'; } 1;
|
|---|