Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: Accessing name of tied variable in tie constructor

by tobyink (Abbot)
on Jul 10, 2013 at 15:04 UTC ( #1043488=note: print w/replies, xml ) Need Help??

in reply to Re: Accessing name of tied variable in tie constructor
in thread Accessing name of tied variable in tie constructor

Even PadWalker and Devel::Caller can't help you - TIEHASH doesn't get passed a reference to the tied variable, so there's no chance of it being able to figure out the variable's name.

Also, the argument this in the Tie::StdHash documentation isn't an identity number; it's a blessed hashref. (It's what most OO Perl code would refer to as $self.)

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043488]
[1nickt]: yes.
[1nickt]: one of the largest distros
[Corion]: I wait for the day when DateTime uses Moose ;)
[TCLion]: finaly finished the install wow that was over 10 min
[1nickt]: Corion using Moose will hardly reduce the number of dependencies or time to install DT !
[davido]: That's like wishing that your motorcycle came with a sherman tank as a trailer.

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-03-23 15:27 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (289 votes). Check out past polls.