Summary: | C4::Biblio exports non-existent subroutines | ||
---|---|---|---|
Product: | Koha | Reporter: | Colin Campbell <colin.campbell> |
Component: | Cataloging | Assignee: | Colin Campbell <colin.campbell> |
Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | gmcharlt, m.de.rooy, mtompset |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | 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 11037 Remove non-existent subs from Biblio's @EXPORT Bug 11037 Remove non-existent subs from Biblio's @EXPORT |
Description
Colin Campbell
2013-10-11 09:58:08 UTC
Created attachment 21959 [details] [review] Proposed patch I wrote the following test and ran it before and after the patch. As expected, the routines were exported before (notice the text is &C4::Biblio), but they were undefined. After the patch, they are no longer in C4::Biblio (notice the text is now &main::), and are still undefined. mtompset@ubuntu:~/kohaclone$ cat ~/test_missing.t #!/usr/bin/perl use Modern::Perl; use Test::More tests => 3; use Try::Tiny; BEGIN { use_ok('C4::Biblio'); } my $check1 = try { Get(); } catch { "$_"; } finally { "ok"; }; print "CHECK: $check1\n"; ok( $check1 =~ /Undefined/ , "Get() is undefined." ); my $check2 = try { TransformHtmlToMarc2(); } catch { "$_"; } finally { "ok"; }; print "CHECK: $check2\n"; ok( $check2 =~ /Undefined/ , "TransformHtmlToMarc2() is undefined." ); mtompset@ubuntu:~/kohaclone$ prove -v ~/test_missing.t /home/mtompset/test_missing.t .. 1..3 ok 1 - use C4::Biblio; CHECK: Undefined subroutine &C4::Biblio::Get called at /home/mtompset/test_missing.t line 11. ok 2 - Get() is undefined. CHECK: Undefined subroutine &C4::Biblio::TransformHtmlToMarc2 called at /home/mtompset/test_missing.t line 16. ok 3 - TransformHtmlToMarc2() is undefined. ok All tests successful. Files=1, Tests=3, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.22 cusr 0.00 csys = 0.23 CPU) Result: PASS mtompset@ubuntu:~/kohaclone$ git bz apply 11037 Bug 11037 - C4::Biblio exports non-existent subroutines 21959 - Proposed patch Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 11037 Remove non-existent subs from Biblio's @EXPORT mtompset@ubuntu:~/kohaclone$ prove -v ~/test_missing.t /home/mtompset/test_missing.t .. 1..3 ok 1 - use C4::Biblio; CHECK: Undefined subroutine &main::Get called at /home/mtompset/test_missing.t line 11. ok 2 - Get() is undefined. CHECK: Undefined subroutine &main::TransformHtmlToMarc2 called at /home/mtompset/test_missing.t line 16. ok 3 - TransformHtmlToMarc2() is undefined. ok All tests successful. Files=1, Tests=3, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.21 cusr 0.00 csys = 0.22 CPU) Result: PASS Created attachment 21963 [details] [review] [SIGNED OFF] Bug 11037 Remove non-existent subs from Biblio's @EXPORT No code implements the subs Get and TransformHtmlToMarc2 so dont export them into users' namespace Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Comment on attachment 21959 [details] [review] Proposed patch Obsoleting non-signed off version. I also tried doing greps to see if they were defined anywhere else in the code. There were no such routines anywhere. $ grep TransformHtmlToMarc2 `find .` $ grep "sub Get" `find .` | less Lots of GetBlah's, but nothing that was just "sub Get". Created attachment 22157 [details] [review] Bug 11037 Remove non-existent subs from Biblio's @EXPORT No code implements the subs Get and TransformHtmlToMarc2 so dont export them into users' namespace Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Pushed to master. Thanks, Colin! |