return undef for ->get() with invalid property

This commit is contained in:
Graham Knop 2009-10-22 10:20:34 -05:00
parent 8b975cc810
commit 9b31593dae
2 changed files with 12 additions and 1 deletions

View file

@ -166,7 +166,10 @@ sub _gen_get {
my $self = shift;
if (@_) {
my $prop = shift;
return $self->$prop;
if ($self->can($prop)) {
return $self->$prop;
}
return undef;
}
my @all_properties = $self->getProperties;
my %props;