http://www.perlmonks.org?node_id=484548

jk2addict has asked for the wisdom of the Perl Monks concerning the following question:

I had reason to use the perl functionality built into a vendors software package today. The package comes with 5.8.3, and it's own set of perl modules to do software related tasks like tweaking data records.

At one point, I have to figure out why this didn't work:

$valobj->value = undef;

but this did:

$valobj->value = '';

After looking into the source code, the object and it's methods use the :lvalue attribute.

sub value : lvalue { my $this = shift; $this->{VALUE}; }

So, that doesn't work if lvalue is undef, but does work if lvalue is an empty string. Is that a 'feature' of the lvalue attribute, or something about the method?

I wouldn't expect this traditional setup to work:

sub value { my ($self, $value) = @_; if (defined $value) { $self->{value} = $value; }; }; $valobj->value(undef);

But I would've expected all the work behind :lvalue to fix that.

Updated: Yes, I've read the pod. It's experimental. Good thing they're using it. The pod doesn't really mention what would happen in the case of setting undef though.

-=Chris