in reply to Re^2: Declaring with my, assigning, and testing in same line (attributes)
in thread Declaring with my, assigning, and testing in same line
As said you'll need to tie cause Attributes happen at compile time and you have to intercept the assignment in STORE.
(didn't know about EXTEND till now)
I'm fine with using tie as long as I can untie when I'm done. Otherwise the penalty for this syntactic sugar would be to huge.
I took a simpler case, tieing a scalar, and trying to use untie $$self within STORE {}. Didn't work. (probably because dereferencing isn't allowed for untie or scope restrictions)
IMO as long we can't automatically untie, this approach shouldn't be used.
update
seems liked I didn't realy understood Tie::StdScalar yet
update
this approach with autotierefuse Attribute::Handlers autotieref => { Selfish => Tie::Selfish };
should provide the necessary reference to the tied structure, so that untieing becomes possible.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Declaring with my, assigning, and testing in same line (attributes)
by choroba (Cardinal) on Dec 12, 2015 at 21:58 UTC | |
by LanX (Saint) on Dec 12, 2015 at 22:05 UTC | |
Re^4: Declaring with my, assigning, and testing in same line (attributes)
by LanX (Saint) on Dec 13, 2015 at 14:53 UTC | |
by choroba (Cardinal) on Dec 13, 2015 at 17:50 UTC | |
by LanX (Saint) on Dec 13, 2015 at 19:39 UTC | |
by choroba (Cardinal) on Dec 15, 2015 at 09:44 UTC | |
by LanX (Saint) on Dec 15, 2015 at 10:23 UTC |