Created
June 29, 2011 15:16
-
-
Save berekuk/1054056 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package X; | |
| # some non-moose abstract class | |
| # there are lots of code using its subclasses | |
| sub write { | |
| die 'not implemented'; | |
| } | |
| package X::Role::Moose; | |
| # so I want to replace it with... | |
| requires 'write'; | |
| around ['does', 'isa'] => sub { | |
| my $orig = shift; | |
| my $self = shift; | |
| return 1 if $_[0] eq 'X'; | |
| return $self->$orig(@_); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment