Check whether refs are blessed before calling can()
This commit is contained in:
parent
29015e28a4
commit
a07d1f5120
@ -25,6 +25,7 @@ package Webperl::System;
|
||||
|
||||
use strict;
|
||||
use base qw(Webperl::SystemModule);
|
||||
use Scalar::Utils qw(blessed);
|
||||
|
||||
# ============================================================================
|
||||
# Constructor and initialiser
|
||||
@ -89,7 +90,7 @@ sub clear {
|
||||
foreach my $key (keys %{$self}) {
|
||||
next if(!defined($self -> {$key})); # skip undefined refs
|
||||
|
||||
$self -> {$key} -> clear() if($self -> {$key} -> can("clear"));
|
||||
$self -> {$key} -> clear() if(blessed($self -> {$key}) && $self -> {$key} -> can("clear"));
|
||||
delete $self -> {$key};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user