Summary: | Compile time warning issued by C4/Record.pm | ||
---|---|---|---|
Product: | Koha | Reporter: | Colin Campbell <colin.campbell> |
Component: | Architecture, internals, and plumbing | Assignee: | Colin Campbell <colin.campbell> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | gmcharlt, kyle, mtompset, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Proposed Patch
[SIGNED OFF] Bug 11058: make variable name unique within its scope Bug 11058: make variable name unique within its scope |
Description
Colin Campbell
2013-10-16 09:07:12 UTC
Created attachment 22010 [details] [review] Proposed Patch Simple renaming of second stylesheet variable. To test without the patch perl -wc C4/Record.pm issues a warning with the patch perl -wc C4/Record.pm issues mo warning Created attachment 22013 [details] [review] [SIGNED OFF] Bug 11058: make variable name unique within its scope routine declares two lexical variables named $stylesheet rename the second to keep code clearer and avoid propagating compile time warnings Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Comment on attachment 22010 [details] [review] Proposed Patch This is now obsolete. mtompset@ubuntu:~/kohaclone$ git checkout -b bug_11058 origin/master Branch bug_11058 set up to track remote branch master from origin. Switched to a new branch 'bug_11058' 1) Confirmed Problem. mtompset@ubuntu:~/kohaclone$ perl -wc C4/Record.pm "my" variable $stylesheet masks earlier declaration in same scope at C4/Record.p m line 313. C4/Record.pm syntax OK 2) Looked at code: mtompset@ubuntu:~/kohaclone$ vi C4/Record.pm The code has a parameter passed named stylesheet, and a variable declared stylesheet. The parameter is used to set other variables which feed into this secondary declaration. So, renaming this variable is a good solution and should not cause any problems. 3) Applied patch mtompset@ubuntu:~/kohaclone$ git bz apply 11058 Bug 11058 - Compile time warning issued by C4/Record.pm 22010 - Proposed Patch Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 11058: make variable name unique within its scope 4) Confirmed problem solved. mtompset@ubuntu:~/kohaclone$ perl -wc C4/Record.pm C4/Record.pm syntax OK 5) Decided to run koha-qa.pl on it for kicks. mtompset@ubuntu:~/kohaclone$ ~/qa-test-tools/koha-qa.pl -v 2 -c 1 testing 1 commit(s) (applied to 0f5dc60 'Bug 10309: (follow-up) restore settin') OK C4/Record.pm OK pod OK forbidden patterns OK valid 0 OK critic 6) Signed it off. mtompset@ubuntu:~/kohaclone$ git so 1 Rewrite f1111fff1071b4a14251d5ecd80bfad07f567e4b (1/1) Ref 'refs/heads/bug_11058' was rewritten mtompset@ubuntu:~/kohaclone$ git commit --amend [bug_11058 72c273c] [SIGNED OFF] Bug 11058: make variable name unique within its scope Author: Colin Campbell <colin.campbell@ptfs-europe.com> 1 file changed, 3 insertions(+), 3 deletions(-) 7) Attached it. mtompset@ubuntu:~/kohaclone$ git bz attach 11058 HEAD Bug 11058 - Compile time warning issued by C4/Record.pm 72c273c [SIGNED OFF] Bug 11058: make variable name unique within its scope Attach? [yn] y Attached SIGNED-OFF-Bug-11058-make-variable-name-unique-wit.patch 8) And now obsolete the old one, and make sure the status is right. Created attachment 22227 [details] [review] Bug 11058: make variable name unique within its scope routine declares two lexical variables named $stylesheet rename the second to keep code clearer and avoid propagating compile time warnings Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Passes koha-qa.pl, works as advertised! Pushed to master. Thanks, Colin! This patch has been pushed to 3.12.x, will be in 3.12.8. Thanks Colin! |