Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: supress an error

by Necos (Friar)
on May 01, 2002 at 21:58 UTC ( [id://163408]=note: print w/replies, xml ) Need Help??


in reply to supress an error

I have a couple of questions.

1.) Why are you defining variables in one package to export to another, when it is just as easy to define them in the program? You can always use Exporter to help you.

Sample: (untested)

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;
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); @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;
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.

Theodore Charles III
Network Administrator
Los Angeles Senior High
4650 W. Olympic Blvd.
Los Angeles, CA 90019
323-937-3210 ext. 224
email->secon_kun@hotmail.com
perl -e "map{print++$_}split//,Mdbnr;"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://163408]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found