in reply to Re: RFC Magic::Attach
in thread RFC Magic::Attach
and the like.sub UNIVERSAL::property { require Magic::Attach; my $self = shift; my $property_name = shift; return Magic::Attached::attached($self, $property_name); } sub UNIVERSAL::but { require Magic::Attach; my $self = shift; my($property_name, $value) =@_; Magic::Attach::attach($self, $property_name, $value); }
The fun begins when you start to try and implement Perl6ish tricks along the lines of return $value->but('true') or (possibly nicer) return $value :but('true'); . For this to work really well you would need have 'but' dispatch to appropriate handlers in some way (possibly through a registry system), but it's not beyond the wit of man...
Can you tell I've been thinking along these lines for a while but have lacked the appropriate tuits?
|
|---|