Skip to content

Fix writing OPL tags to the problem file. - #3235

Open
drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:bugfix/write-tags
Open

drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:bugfix/write-tags

Conversation

@drgrice1

Copy link
Copy Markdown
Member

I change the name of the method that writes the tags of a WeBWorK::Utils::Tags object to its problem file from write to write_to_file in #3126. However, I didn't change the method name in place where this method was called in the WeBWorK::Utils::ListingDB package. As a result writing tags fails.

Note that the method name write does not pass the Subroutines::ProhibitBuiltinHomonyms policy. However, it only fails the policy with the caveat explicitly stated in their documentation which states "It is reasonable to declare an object method with the same name as a Perl built-in function, since they are easily distinguished from each other. However, at this time, Perl::Critic cannot tell whether a subroutine is static or an object method." This is one of my annoyances with that rule. It is generally a good rule, but it can't be implemented well. So the fix implemented here is to rename the method back to write, since it is a perfectly good object method name, and add ## no critic (Subroutines::ProhibitBuiltinHomonyms) to the line.

I change the name of the method that writes the tags of a
`WeBWorK::Utils::Tags` object to its problem file from `write` to
`write_to_file` in openwebwork#3126.  However, I didn't change the method name in
place where this method was called in the `WeBWorK::Utils::ListingDB`
package. As a result writing tags fails.

Note that the method name `write` does not pass the
`Subroutines::ProhibitBuiltinHomonyms` policy.  However, it only fails
the policy with the caveat explicitly stated in their documentation
which states "It is reasonable to declare an object method with the same
name as a Perl built-in function, since they are easily distinguished
from each other. However, at this time, Perl::Critic cannot tell whether
a subroutine is static or an object method." This is one of my
annoyances with that rule.  It is generally a good rule, but it can't be
implemented well.  So the fix implemented here is to rename the method
back to `write`, since it is a perfectly good object method name, and
add `## no critic (Subroutines::ProhibitBuiltinHomonyms)` to the line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants