|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
ultimatebb.cgi employs the obsolete "use vars" instead of "our", presumably for compatibility with older Perl versions.
I've used "our" in my scripts, but don't completely understand how it works (although I've mostly been able to get it to work by trial and error).
Is "our" equivalent to "use vars"?
For example, if, on a system running Perl 5.6+, the "use vars qw(%vars_poll ... $title_wording);" in ultimatebb.cgi were replaced with "our (%vars_poll ... $title_wording);", would the script function the same way?
|
|
|
|
Joined: Aug 2000
Posts: 335
Member
|
Member
Joined: Aug 2000
Posts: 335 |
You're correct about the commas, I forgot to include them above.
Thanks for the answer and the helpful link.
I think I had misunderstood the function of our. Unlike my, our doesn't allocate space for a variable, it just provides a lexically-scoped alias. Since I generally prefer using fully qualified variables, perhaps I was trying to forcibly use our in situations where it wasn't really needed.
|
|
|
|
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
|
P.I.T.A. / Programmer
Joined: Sep 2000
Posts: 755 |
Correct... our is for scoping. I believe it can work across packages but to tell you the truth, I don't know for sure because I never use it. All the stuff I do needs to stay compatible with perl versions < 5.6.x so I can't use it
"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 69
Joined: January 2001
|
|
Forums63
Topics37,575
Posts293,931
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|
|