Commit | Line | Data |
f7ea4120 |
1 | package Object::Remote::LogDestination; |
2 | |
3 | use Moo; |
4 | use Scalar::Util qw(weaken); |
5 | |
6 | has logger => ( is => 'ro', required => 1 ); |
7 | has subscriptions => ( is => 'ro', required => 1, default => sub { [] } ); |
8 | |
9 | sub select { |
5d59cb98 |
10 | my ($self, $router, $selector) = @_; |
11 | my $subscription = $router->subscribe($self->logger, $selector); |
12 | push(@{ $self->subscriptions }, $subscription); |
13 | return $subscription; |
f7ea4120 |
14 | } |
15 | |
16 | sub connect { |
5d59cb98 |
17 | my ($self, $router) = @_; |
18 | return $self->select($router, sub { 1 }); |
f7ea4120 |
19 | } |
20 | |
4a9fa1a5 |
21 | 1; |
22 | |
23 | |