From: Breno G. de Oliveira Date: Sun, 30 Aug 2009 03:51:58 +0000 (-0300) Subject: require Carp only on error. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=69e6e19134fb31a2b6c15c06463f55d46ba3dc58;p=sdlgit%2FSDL_perl.git require Carp only on error. --- diff --git a/lib/SDL/Rect.pm b/lib/SDL/Rect.pm index d557cdd..bef0f03 100644 --- a/lib/SDL/Rect.pm +++ b/lib/SDL/Rect.pm @@ -32,7 +32,6 @@ package SDL::Rect; use strict; use warnings; -use Carp; use SDL; sub new { @@ -48,7 +47,10 @@ sub new { my $h = $options{-height} || $options{-h} || 0; my $self = \SDL::NewRect($x,$y,$w,$h); - croak SDL::GetError() unless $$self; + unless ($$self) { + require Carp; + Carp::croak SDL::GetError(); + } bless $self,$class; return $self; } @@ -70,7 +72,7 @@ sub x { SDL::RectX($$self,@_); } -### TODO: see 'left' above +### TODO: see 'left' above (this is an 'alias' to sub y) sub top { my $self = shift; SDL::RectY($$self,@_); @@ -81,7 +83,7 @@ sub y { SDL::RectY($$self,@_); } -### TODO: see 'left' above +### TODO: see 'left' above (this is an 'alias' to sub width) sub w { my $self = shift; SDL::RectW($$self,@_); @@ -92,7 +94,7 @@ sub width { SDL::RectW($$self,@_); } -### TODO: see 'left' above +### TODO: see 'left' above (this is an 'alias' to sub height) sub h { my $self = shift; SDL::RectH($$self,@_);