Bug 6875 de-nesting C4::Koha.pm
authorPaul Poulain <paul.poulain@biblibre.com>
Fri, 16 Sep 2011 16:28:00 +0000 (18:28 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Wed, 15 Feb 2012 13:58:28 +0000 (14:58 +0100)
* removed use C4::Output, that was not used
* moved use URI::split to getitemtypeimagelocation and switched to "require".
  Checked it still works through admin/itemtype.pl
* moved use Business::ISBN to _isbn_cleanup.pl and switched to "require".
  Checked it still works with the following small script :

use C4::Koha;
print GetNormalizedISBN("1-56592-257-3");

(GetNormalizedISBN uses _isbn_cleanup)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
C4/Koha.pm

index 789f674..976b46a 100644 (file)
@@ -23,10 +23,7 @@ package C4::Koha;
 use strict;
 #use warnings; FIXME - Bug 2505
 use C4::Context;
-use C4::Output;
-use URI::Split qw(uri_split);
 use Memoize;
-use Business::ISBN;
 
 use vars qw($VERSION @ISA @EXPORT $DEBUG);
 
@@ -472,8 +469,9 @@ sub getitemtypeimagelocation($$) {
        my ( $src, $image ) = @_;
 
        return '' if ( !$image );
+    require URI::Split;
 
-       my $scheme = ( uri_split( $image ) )[0];
+       my $scheme = ( URI::Split::uri_split( $image ) )[0];
 
        return $image if ( $scheme );
 
@@ -1315,6 +1313,7 @@ sub _normalize_match_point {
 }
 
 sub _isbn_cleanup {
+    require Business::ISBN;
     my $isbn = Business::ISBN->new( $_[0] );
     if ( $isbn ) {
         $isbn = $isbn->as_isbn10 if $isbn->type eq 'ISBN13';