File Coverage

blib/lib/POE/Component/MessageQueue/Subscription.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             #
2             # Copyright 2007-2010 David Snopek <dsnopek@gmail.com>
3             #
4             # This program is free software: you can redistribute it and/or modify
5             # it under the terms of the GNU General Public License as published by
6             # the Free Software Foundation, either version 2 of the License, or
7             # (at your option) any later version.
8             #
9             # This program is distributed in the hope that it will be useful,
10             # but WITHOUT ANY WARRANTY; without even the implied warranty of
11             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12             # GNU General Public License for more details.
13             #
14             # You should have received a copy of the GNU General Public License
15             # along with this program. If not, see <http://www.gnu.org/licenses/>.
16             #
17              
18             package POE::Component::MessageQueue::Subscription;
19 13     13   96 use Moose;
  13         37  
  13         84  
20              
21             has client => (
22             is => 'ro',
23             isa => 'POE::Component::MessageQueue::Client',
24             weak_ref => 1,
25             required => 1,
26             );
27              
28             has destination => (
29             is => 'ro',
30             does => 'POE::Component::MessageQueue::Destination',
31             weak_ref => 1,
32             required => 1,
33             );
34              
35             has client_ack => (
36             is => 'ro',
37             default => 0,
38             );
39              
40             has ready => (
41             is => 'rw',
42             default => 1,
43             );
44              
45             # Ready will always return true if client_ack is false.
46             around ready => sub {
47             my $original = shift;
48             my $self = shift;
49              
50             return $original->($self, @_) if (@_ || $self->client_ack);
51              
52             return 1;
53             };
54              
55             __PACKAGE__->meta->make_immutable();
56              
57             1;