check for existence of attribute before calling it to break gently

This commit is contained in:
Isaac Connor 2016-10-04 14:07:11 -04:00
parent 866b6fea8c
commit df255d3d5d
1 changed files with 5 additions and 1 deletions

View File

@ -272,7 +272,11 @@ sub _initialize {
#
$_method =~s{\.}{__}xg;
$_method =~s{\-}{_}xg;
$list->[-1]->$_method( $current );
if ( $list->[-1]->can( $_method ) ) {
$list->[-1]->$_method( $current );
} else {
print ( "ERror " . $list->[-1] . " cannot $_method\n" );
}
$current = pop @$list; # step up in object hierarchy