Closed Bug 282124 Opened 20 years ago Closed 20 years ago

Remove globals.pl and CGI.pl from editclassifications.cgi

Categories

(Bugzilla :: Bugzilla-General, enhancement)

2.19.2
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(1 file, 1 obsolete file)

This script doesn't really need these libraries. The calls to them can be safely removed with only minor changes.
Status: NEW → ASSIGNED
Target Milestone: --- → Bugzilla 2.20
Attached patch Remove libraries from editclassifications.cgi (obsolete) (deleted) — Splinter Review
Attachment #174222 - Flags: review?
Attached patch v1.1 (changed $vars) (deleted) — Splinter Review
This makes it more exactly like what globals.pl used to do.
Attachment #174222 - Attachment is obsolete: true
Attachment #174224 - Flags: review?
Attachment #174222 - Flags: review?
Attachment #174224 - Flags: review? → review+
Flags: approval?
Question: are any of those perl modules depending on being able to access $::vars? We need to make sure the modules aren't expecting $::vars to exist as well. (If you've done that, say so and you've got my approval)
Oh, good point. Of course, doesn't having a "my $vars" in the CGI actually create a $main::vars? That is, isn't the CGI $main? I'll investigate it, though. We're not using too many of the module functions.
OK, so nothing that we use depends on the global $::vars: [mkanat@landfill mkanat]$ grep -R "::vars" Bugzilla* Bugzilla/Flag.pm:# so I have to use them as $::template and $::vars in the package code. Bugzilla/Flag.pm: $::vars->{'flag'} = $flag; Bugzilla/Flag.pm: $::template->process($template_file, $::vars, \$message); Bugzilla/Token.pm: my $vars = $::vars; Bugzilla/Token.pm: my $vars = $::vars; Bugzilla/Token.pm: my $vars = $::vars; Bugzilla/User.pm: my $vars = $::vars; That Bugzilla::User function is match_field, which we definitely don't use. :-) So we're good to go.
(In reply to comment #4) > Of course, doesn't having a "my $vars" in the CGI actually create a $main::vars? "my $vars" creates a variable which is not in a namespace, and is scoped locally to the current code block. It can't be referenced from outside the block of code containing it. (think braces {} ) > That is, isn't the CGI $main? Only if it's running standalone. If it's running under mod_perl, the CGI will be ModPerl::PerlRun::ROOT::editcomponents_e2cgi:: or something to that effect, and $::vars will still refer to main::. Note that |use vars qw( $vars )| will import $::vars into the local namespace so it can be referenced as $vars, so make sure you're looking for that as well when looking in the modules. > I'll investigate it, though. We're not using too many of the module functions. In the long run, it'd probably be best that we fix the modules to require $vars to be passed in to them instead of looking for it at $::vars.
Flags: approval? → approval+
Checking in editclassifications.cgi; /cvsroot/mozilla/webtools/bugzilla/editclassifications.cgi,v <-- editclassifications.cgi new revision: 1.4; previous revision: 1.3 done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: