| 1 | package Danga::Socket::Callback; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use base qw(Danga::Socket); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use fields qw(on_read_ready on_write_ready on_error on_signal_hup context); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | our $VERSION = '0.013'; | |||||||||
| 8 | |||||||||||
| 9 | sub new | ||||||||||
| 10 | 0 | ▶ | { | ||||||||
|
Subroutine
new: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 11 | 0 | my Danga::Socket::Callback $self = shift; | |||||||||
| 12 | 0 | my %args = @_; | |||||||||
| 13 | 0 | ▶ | $self = fields::new($self) unless ref $self; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 0 | $self->SUPER::new($args{handle}); | |||||||||
| 15 | |||||||||||
| 16 | 0 | foreach my $field (qw(on_read_ready on_write_ready on_error on_signal_hup context)) { | |||||||||
| 17 | 0 | ▶ | $self->{$field} = $args{$field} if $args{$field} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | if ($self->{on_read_ready}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 0 | $self->watch_read(1); | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | if ($self->{on_write_ready}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | $self->watch_write(1); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | return $self; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | sub event_read | ||||||||||
| 32 | 0 | ▶ | { | ||||||||
|
Subroutine
event_read: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 33 | 0 | my Danga::Socket::Callback $self = shift; | |||||||||
| 34 | 0 | ▶ | if (my $code = $self->{on_read_ready}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | return $code->($self); | |||||||||
| 36 | } | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | sub event_write | ||||||||||
| 40 | 0 | ▶ | { | ||||||||
|
Subroutine
event_write: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 41 | 0 | my Danga::Socket::Callback $self = shift; | |||||||||
| 42 | 0 | ▶ | if (my $code = $self->{on_write_ready}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | return $code->($self); | |||||||||
| 44 | } else { | ||||||||||
| 45 | 0 | $self->SUPER::event_write(); | |||||||||
| 46 | } | ||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | sub event_hup | ||||||||||
| 50 | 0 | ▶ | { | ||||||||
|
Subroutine
event_hup: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 51 | 0 | my Danga::Socket::Callback $self = shift; | |||||||||
| 52 | 0 | ▶ | if (my $code = $self->{on_signal_hup}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | 0 | return $code->($self); | |||||||||
| 54 | } | ||||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | sub event_err | ||||||||||
| 58 | 0 | ▶ | { | ||||||||
|
Subroutine
event_err: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 59 | 0 | my Danga::Socket::Callback $self = shift; | |||||||||
| 60 | 0 | ▶ | if (my $code = $self->{on_error}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | $code->($self); | |||||||||
| 62 | } | ||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 1 | 1; | |||||||||
| 66 | |||||||||||
| 67 | __END__ | ||||||||||