Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate the new Reflex::Role usage to old users of Reflex::Util::Me…
…thods. I still don't like the function names, but they're good placeholders for now.
- Loading branch information
Showing
13 changed files
with
123 additions
and
140 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
package AfterAwhileRole; | ||
use MooseX::Role::Parameterized; | ||
use Reflex::Util::Methods qw(method_name emit_an_event); | ||
use Reflex::Role; | ||
|
||
parameter name => ( isa => 'Str', default => 'name' ); | ||
parameter awhile => ( isa => 'Str', default => 'awhile' ); | ||
parameter cb => method_name("on", "name", "done"); | ||
attribute_parameter name => "name"; | ||
attribute_parameter awhile => "awhile"; | ||
callback_parameter cb => qw( on name done ); | ||
|
||
role { | ||
my $role_param = shift; | ||
|
||
my $role_name = $role_param->name(); | ||
my $cb_done = $role_param->cb(); | ||
my $awhile = $role_param->awhile(); | ||
|
||
method_emit $cb_done => "done"; | ||
|
||
sub BUILD {} | ||
|
||
after BUILD => sub { | ||
my $self = shift; | ||
sleep($self->$awhile()); | ||
$self->$cb_done(); | ||
}; | ||
|
||
method $cb_done => emit_an_event("done"); | ||
}; | ||
|
||
1; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.