Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Re: Re: Re: More problems with CGI::Sessionby oubiwann (Sexton) |
on Mar 15, 2002 at 05:38 UTC ( [id://151907]=note: print w/replies, xml ) | Need Help?? |
Yeah, I have used use vars for global cgi stuff in the past. I definitely have to go with your suggestion about .pm's, though - that's such a great way to fly. But there's nothing that says you can't mix it all up - require, use vars, and .pm's! Bugzilla does :-) Man, I love that monstrosity. Sometimes when I'm bored, I like to just read through the crazy things those guys have done.
Update Well, to make a variable truely global in perl, you just declare it with no 'my': $your_var = "something cool"; If you don't want to get scope warnings, just do $::your_var or $main::your_var. This means that you will be using package variables, not lexical variables (like 'my' or 'our'). Again, for clarity's (and your sanity a few months from now) sake you might want to refer to these with $main:: or $::, since that is the default package you will be using... and as soon as you see these you will know what they are. The other option (which might not be as clear a few months after you finish your project) would be to do 'use strict' and then do (all your global variables here) Like I said, I have done this in the past, but I don't think I would do it now. Man, I hope this is clear; I'm not good at expressing this kind of thing - unfortunately, I am an intuitive programmer. Let us know how it goes.
In Section
Seekers of Perl Wisdom
|
|