From: Kartik Thakore Date: Sun, 13 Sep 2009 23:13:31 +0000 (-0400) Subject: Fixed Rect usage X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=987e15424562ed4ad64af8aafa070122ba971c28;p=sdlgit%2FSDL_perl.git Fixed Rect usage --- diff --git a/t/extendingrect.t b/t/extendingrect.t index f27ab52..3a10047 100644 --- a/t/extendingrect.t +++ b/t/extendingrect.t @@ -3,17 +3,12 @@ use base 'SDL::Rect'; sub new { my $class = shift; - my $x = shift || 0; - my $y = shift || 0; - my $w = shift || 0; - my $h = shift || 0; - my $self = $class->SUPER::new($x, $y, $w, $h); - unless ($$self) { + my $self = $class->SUPER::new(@_); + unless (ref $self) { require Carp; Carp::croak SDL::GetError(); } - bless $self, $class; - return $self; + return bless $self => $class;; } @@ -25,7 +20,7 @@ sub foo { package main; use Test::More tests => 6; -my $rect = MyRect->new; +my $rect = MyRect->new(0,0,0,0); isa_ok($rect, 'SDL::Rect'); isa_ok($rect, 'MyRect');