Bug 11037 - C4::Biblio exports non-existent subroutines
Summary: C4::Biblio exports non-existent subroutines
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Colin Campbell
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-11 09:58 UTC by Colin Campbell
Modified: 2014-12-07 20:02 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed patch (883 bytes, patch)
2013-10-11 10:06 UTC, Colin Campbell
Details | Diff | Splinter Review
[SIGNED OFF] Bug 11037 Remove non-existent subs from Biblio's @EXPORT (951 bytes, patch)
2013-10-11 12:02 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 11037 Remove non-existent subs from Biblio's @EXPORT (1.03 KB, patch)
2013-10-21 13:33 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Campbell 2013-10-11 09:58:08 UTC
C4/Biblio.pm exports two subroutine names Get and TransformHtmlToMarc2 which do not correspond to actual subroutines. They should be removed from @EXPORT
Comment 1 Colin Campbell 2013-10-11 10:06:46 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2013-10-11 12:01:26 UTC
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
Comment 3 Mark Tompsett 2013-10-11 12:02:35 UTC
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 4 Mark Tompsett 2013-10-11 12:03:37 UTC
Comment on attachment 21959 [details] [review]
Proposed patch

Obsoleting non-signed off version.
Comment 5 Mark Tompsett 2013-10-11 12:06:36 UTC
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".
Comment 6 Marcel de Rooy 2013-10-21 13:33:35 UTC
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>
Comment 7 Galen Charlton 2013-10-21 15:32:59 UTC
Pushed to master.  Thanks, Colin!