develooper Front page | perl.perl6.language | Postings from March 2009

Roles driven by events

Thread Next
March 16, 2009 10:30
Roles driven by events
Message ID:
Having a problem with the following role in Perl 5:

  package PIPs::ResultSource::Role::HasTags;
  use Moose::Role;

  requires 'do_setup';
  after 'do_setup' => sub { ... };

So far this has worked really well, aside from that one class which didn't call 'do_setup'.  Oops.

Requiring methods and requiring methods to be called are different things.  It might be a nice feature to have roles which tie into "events".  If a particular condition doesn't hold true by, say, INIT time, the role fails.

How would I implement something like that in Perl 6?  Or am I just looking at this wrong?

Buy the book         -
Tech blog            -
Twitter              -
Official Perl 6 Wiki -

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About