[Kc] thinking about interpolation of accessors

David Nicol davidnicol at gmail.com
Thu Feb 20 12:42:15 PST 2014


A common Perl newbie error is to try to use an object accessor method in an
interpolative context and expect to get the value, like so

     DEBUG and print "the blurf field is $self->blurf\n";

which (of course) doesn't work, because blurf is a method call, not a
syncactic container access like $self->{blurf}.

An extension to Perl that would allow that to work would have to hook back
into the interpolation process.

Anyone for tinkering under perl's hood towards defining a package attribute
that would indicate that method syntax interpolates?



-- 

"Sing, cuckoo, sing.
Death is a-comin' in.
Sing, cuckoo, sing.
Death is a-comin' in" -- Tuli Kupferberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/kc/attachments/20140220/e6522864/attachment.html>


More information about the kc mailing list