Can't use superclass constructor; objects may not be avilable.

This commit is contained in:
Chris 2012-08-09 16:00:02 +01:00
parent 61cca195da
commit 6f756e4131
3 changed files with 19 additions and 3 deletions

View File

@ -66,8 +66,13 @@ use constant ADMIN_TYPE => 3; # User type for admin users.
sub new { sub new {
my $invocant = shift; my $invocant = shift;
my $class = ref($invocant) || $invocant; my $class = ref($invocant) || $invocant;
# Note this doesn't use the superclass constructor, as it may be called before
# the objects the superclass checks for are acutally available
my $self = {
@_,
};
return $class -> SUPER::new(@_); return bless $self, $class;
} }

View File

@ -57,7 +57,13 @@ use AuthMethods;
sub new { sub new {
my $invocant = shift; my $invocant = shift;
my $class = ref($invocant) || $invocant; my $class = ref($invocant) || $invocant;
return $class -> SUPER::new(@_); # Note this doesn't use the superclass constructor, as it may be called before
# the objects the superclass checks for are acutally available
my $self = {
@_,
};
return bless $self, $class;
} }

View File

@ -40,8 +40,13 @@ use base qw(SystemModule);
sub new { sub new {
my $invocant = shift; my $invocant = shift;
my $class = ref($invocant) || $invocant; my $class = ref($invocant) || $invocant;
# Note this doesn't use the superclass constructor, as it may be called before
# the objects the superclass checks for are acutally available
my $self = {
@_,
};
return $class -> SUPER::new(@_); return bless $self, $class;
} }