|
Revision 702
(checked in by miyagawa, 3 years ago)
|
re-commit [697] to feature-server branch
|
| Line | |
|---|
| 1 |
package Plagger::Server::Protocol; |
|---|
| 2 |
use strict; |
|---|
| 3 |
|
|---|
| 4 |
sub new { |
|---|
| 5 |
my $class = shift; |
|---|
| 6 |
bless { |
|---|
| 7 |
protocols => [], |
|---|
| 8 |
}, $class; |
|---|
| 9 |
} |
|---|
| 10 |
|
|---|
| 11 |
sub add_protocol { |
|---|
| 12 |
my($self, $protocol) = @_; |
|---|
| 13 |
push @{ $self->{protocols} }, $protocol; |
|---|
| 14 |
} |
|---|
| 15 |
|
|---|
| 16 |
sub delete_protocol { |
|---|
| 17 |
my($self, $protocol) = @_; |
|---|
| 18 |
my @protocols = grep { $_ ne $protocol } $self->protocols; |
|---|
| 19 |
$self->{protocols} = \@protocols; |
|---|
| 20 |
} |
|---|
| 21 |
|
|---|
| 22 |
sub protocols { |
|---|
| 23 |
my $self = shift; |
|---|
| 24 |
wantarray ? @{ $self->{protocols} } : $self->{protocols}; |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
sub count { |
|---|
| 28 |
my $self = shift; |
|---|
| 29 |
scalar @{ $self->{protocols} }; |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
1; |
|---|
| 33 |
|
|---|