The problem is that I am using AUTOLOAD to get/set some properties of an object. However it seems that whenever I set the property to '' and then try to retrieve the object I get undef returned.
The code is below. Thanks for any help you can provide.
sub AUTOLOAD { my $self = shift; my $function = our $AUTOLOAD; $function =~ /::DESTROY/ && return; #ignore the DESTROY call $function =~ s/.*:://; if(@_) { my $new_value = shift; if($new_value ne $self->{$function}) { $self->{$function} = $new_value; #mark this object as changed unless we are modifying the #dirty bit itself $self->{dirty} = 1 if $function ne 'dirty'; } } return $self->{$function}; }
In reply to AUTOLOAD returns '' as undef by BarMeister
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |