method as trigger

[email protected] (Ch Lamprecht)
Newsgroups perl.moose
Message-ID <[email protected]>
Hello,

I was trying to use a method of my class as 'trigger' in an attributes 
definition. Here is what I wrote:

has pub_in_a_TkObjectsModel_Instance => ( isa => 'TkObjectsModel',
                                           is  => 'rw',
                                       trigger => sub{$_[0] -> changed($_[2])},
                                      );

That works fine. However, are there more elegant solutions? Wouldn't it be a 
nice feature, if we could say:

...
trigger => 'changed',
...

(Like in a Perl-Tk callback definition)?

Christoph
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.