From 857aeaa179154ca1ccedfa8d101744113679ecd2 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 9 Aug 2012 12:29:58 +0100 Subject: [PATCH] Updated to correctly invoke superclass constructor. --- AppUser.pm | 5 +---- Auth.pm | 6 +----- AuthMethods.pm | 16 ++++++---------- System.pm | 5 +---- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/AppUser.pm b/AppUser.pm index d677996..e1f3460 100644 --- a/AppUser.pm +++ b/AppUser.pm @@ -66,11 +66,8 @@ use constant ADMIN_TYPE => 3; # User type for admin users. sub new { my $invocant = shift; my $class = ref($invocant) || $invocant; - my $self = { - @_, - }; - return bless $self, $class; + return $class -> SUPER::new(@_); } diff --git a/Auth.pm b/Auth.pm index f3c1ca6..33b5b8f 100644 --- a/Auth.pm +++ b/Auth.pm @@ -57,11 +57,7 @@ use AuthMethods; sub new { my $invocant = shift; my $class = ref($invocant) || $invocant; - my $self = { - @_, - }; - - return bless $self, $class; + return $class -> SUPER::new(@_); } diff --git a/AuthMethods.pm b/AuthMethods.pm index 858abc4..ba6d955 100644 --- a/AuthMethods.pm +++ b/AuthMethods.pm @@ -40,18 +40,15 @@ use Module::Load; sub new { my $invocant = shift; my $class = ref($invocant) || $invocant; - my $self = { - @_, - }; + my $self = $class -> SUPER::new(@_); + + return undef if(!$self); # Ensure that we have objects that we need - return SystemModule::set_error("cgi object not set") unless($self -> {"cgi"}); - return SystemModule::set_error("dbh object not set") unless($self -> {"dbh"}); - return SystemModule::set_error("settings object not set") unless($self -> {"settings"}); - return SystemModule::set_error("app object not set") unless($self -> {"app"}); - return SystemModule::set_error("logger object not set") unless($self -> {"logger"}); + return SystemModule::set_error("cgi object not set") unless($self -> {"cgi"}); + return SystemModule::set_error("app object not set") unless($self -> {"app"}); - return bless $self, $class; + return $self; } @@ -152,4 +149,3 @@ sub load_method { } 1; - diff --git a/System.pm b/System.pm index 0bdfd52..8ab920a 100644 --- a/System.pm +++ b/System.pm @@ -40,11 +40,8 @@ use base qw(SystemModule); sub new { my $invocant = shift; my $class = ref($invocant) || $invocant; - my $self = { - @_, - }; - return bless $self, $class; + return $class -> SUPER::new(@_); }