Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified default callbacks that emit events. Added stubs for other …
…necessary roles.
- Loading branch information
Showing
12 changed files
with
75 additions
and
28 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO - An absolute time alarm that can be snoozed, etc. |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO - Makes a connection. |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO - Interacts with datagram sockets. |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package EmitHelper; | ||
|
||
use warnings; | ||
use strict; | ||
|
||
use Exporter; | ||
use base 'Exporter'; | ||
|
||
our @EXPORT_OK = qw(default_emit); | ||
|
||
# Helper function. Returns a role method that emits an event. Used | ||
# as the default callback for many things. | ||
|
||
sub default_emit { | ||
my ($cb_name, $event) = @_; | ||
return( | ||
$cb_name => sub { | ||
my ($self, $args) = @_; | ||
$self->emit(event => $event, args => $args); | ||
} | ||
); | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO - Listens for new connections. |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO - Handle SIGCHLD |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package Signal; | ||
use MoseX::Role::Parameterized; | ||
|
||
parameter signal => ( | ||
isa => 'Str', | ||
required => 1, | ||
); | ||
|
||
parameter cb_signal => ( | ||
isa => 'Str', | ||
default => sub { | ||
my $self = shift; | ||
"on_" . lc($self->signal()) . "_caught"; | ||
}, | ||
lazy => 1, | ||
); | ||
|
||
role { | ||
after BUILD => sub { | ||
# ... register the handler | ||
}; | ||
|
||
method stop => sub { | ||
# ... deregister the signal handler | ||
}; | ||
|
||
after DEMOLISH => sub { | ||
# ... make sure the signal is not watched anymore | ||
}; | ||
}; | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO - Handle signals, generically. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO - A periodic timer that throws repeating events. |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# TODO - A delay-like timeout that can be reset. |