| 1 | package Net::Gnutella::Packet::Ping; | ||||||||||
| 2 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use vars qw/$VERSION $AUTOLOAD/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | $VERSION = $VERSION = "0.1"; | |||||||||
| 7 | |||||||||||
| 8 | # Use AUTOHANDLER to supply generic attribute methods | ||||||||||
| 9 | # | ||||||||||
| 10 | 0 | ▶ | sub AUTOLOAD { | ||||||||
|
Subroutine
AUTOLOAD: not called CC=4 SCAR=30.0
| |||||||||||
| 11 | 0 | my $self = shift; | |||||||||
| 12 | 0 | my $attr = $AUTOLOAD; | |||||||||
| 13 | 0 | $attr =~ s/.*:://; | |||||||||
| 14 | 0 | ▶ | return unless $attr =~ /[^A-Z]/; # skip DESTROY and all-cap methods | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 0 | ▶ | croak sprintf "invalid attribute method: %s->%s()", ref($self), $attr unless exists $self->{_attr}->{lc $attr}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 0 | ▶ | $self->{_attr}->{lc $attr} = shift if @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 0 | return $self->{_attr}->{lc $attr}; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 21 | 0 | my $proto = shift; | |||||||||
| 22 | 0 | my %args = @_; | |||||||||
| 23 | |||||||||||
| 24 | 0 | my $self = { | |||||||||
| 25 | _attr => { | ||||||||||
| 26 | msgid => [], | ||||||||||
| 27 | ttl => 7, | ||||||||||
| 28 | hops => 1, | ||||||||||
| 29 | function => 0, | ||||||||||
| 30 | }, | ||||||||||
| 31 | }; | ||||||||||
| 32 | |||||||||||
| 33 | 0 | bless $self, $proto; | |||||||||
| 34 | |||||||||||
| 35 | 0 | foreach my $key (keys %args) { | |||||||||
| 36 | 0 | my $lkey = lc $key; | |||||||||
| 37 | |||||||||||
| 38 | 0 | $self->$lkey($args{$key}); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 0 | return $self; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub parse { | ||||||||
|
Subroutine
parse: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 45 | 0 | return; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub format { | ||||||||
|
Subroutine
format: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 49 | 0 | return; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 1 | 1; | |||||||||