From 2c11bfe0c4df6b6201bce8c44b5763151dacf42c Mon Sep 17 00:00:00 2001 From: "Randy J. Ray" Date: Wed, 21 Oct 2009 18:39:27 -0700 Subject: [PATCH] Moved around some conditionally-needed libs to delay loading until/unless needed. Also made a small fix per Perl::Critic. --- lib/Image/Size.pm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/Image/Size.pm b/lib/Image/Size.pm index 6e9da54..b3c614c 100644 --- a/lib/Image/Size.pm +++ b/lib/Image/Size.pm @@ -23,9 +23,6 @@ require 5.006; use strict; use warnings; use bytes; -use Cwd (); -use File::Spec (); -use Symbol (); use AutoLoader 'AUTOLOAD'; require Exporter; @@ -41,7 +38,7 @@ BEGIN %CACHE $NO_CACHE $PCD_SCALE $GIF_BEHAVIOR); %EXPORT_TAGS = ('all' => [ @EXPORT_OK ]); - $VERSION = "3.2"; + $VERSION = "3.210"; # Default behavior for GIFs is to return the "screen" size $GIF_BEHAVIOR = 0; @@ -170,6 +167,9 @@ sub imgsize { unless ($NO_CACHE) { + require Cwd; + require File::Spec; + $stream = File::Spec->catfile(Cwd::cwd(),$stream) unless File::Spec->file_name_is_absolute($stream); $mtime = (stat $stream)[9]; @@ -185,8 +185,9 @@ sub imgsize } #first try to open the stream + require Symbol; $handle = Symbol::gensym(); - open($handle, "< $stream") or + open($handle, "<", $stream) or return (undef, undef, "Can't open image file $stream: $!"); $need_close = 1; @@ -275,7 +276,7 @@ sub imagemagick_size { } } -# load Graphics::Magick or Image::Magick if one is not already loaded. +# load Graphics::Magick or Image::Magick if one is not already loaded. sub _load_magick_module { my $module_name = shift; eval { @@ -773,6 +774,10 @@ L L +=item * Project page on GitHub + +L + =back =head1 COPYRIGHT & LICENSE