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

Roles driven by events

Thread Next
From:
Ovid
Date:
March 16, 2009 10:30
Subject:
Roles driven by events
Message ID:
501519.98373.qm@web65702.mail.ac4.yahoo.com
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?

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About