| 1 | package Net::FSP::Handle::Write; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | our $VERSION = $Net::FSP::VERSION; | |||||||||
| 5 | 2 | ▶ | use Net::FSP::Handle qw/do_or_fail/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use base 'Net::FSP::Handle'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 0 | ▶ | sub OPEN { | ||||||||
|
Subroutine
OPEN: not called CC=2 SCAR=17.9
| |||||||||||
| 9 | 0 | my ($self, $mode, $filename) = @_; | |||||||||
| 10 | 0 | ▶ | $self->CLOSE if keys %{$self} > 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 0 | $self->{writer} = $self->{fsp}->_get_writer($filename); | |||||||||
| 12 | 0 | return $self; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub PRINT { | ||||||||
|
Subroutine
PRINT: not called CC=2 SCAR=17.9
| |||||||||||
| 16 | 0 | my ($self, @args) = @_; | |||||||||
| 17 | 0 | ▶ | my $separator = defined $, ? $, : ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 0 | my $buffer = join $separator, @args; | |||||||||
| 19 | 0 | return $self->WRITE($buffer, length $buffer, 0); | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | sub PRINTF { | ||||||||
|
Subroutine
PRINTF: not called CC=1 SCAR=6.9
| |||||||||||
| 23 | 0 | my ($self, @args) = @_; | |||||||||
| 24 | 0 | my $buffer = sprintf shift, @args; | |||||||||
| 25 | 0 | return $self->WRITE($buffer, length $buffer, 0); | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub WRITE { | ||||||||
|
Subroutine
WRITE: not called CC=1 SCAR=6.9
| |||||||||||
| 29 | 0 | my ($self, $buffer, $length, $offset) = @_; | |||||||||
| 30 | 0 | ▶ | return do_or_fail { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 31 | 0 | $self->{writer}->(substr $buffer, $offset, $length); | |||||||||
| 32 | 0 | }; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | sub EOF { | ||||||||
|
Subroutine
EOF: not called CC=1 SCAR=6.9
| |||||||||||
| 36 | 0 | return 0; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | ▶ | sub CLOSE { | ||||||||
|
Subroutine
CLOSE: not called CC=1 SCAR=6.9
| |||||||||||
| 40 | 0 | my $self = shift; | |||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | my $ret = do_or_fail { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 43 | 0 | ▶ | $self->{writer}->(undef) if defined $self->{writer}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | }; | |||||||||
| 45 | 0 | $self->SUPER::CLOSE; | |||||||||
| 46 | 0 | return $ret; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 2 | 1; | |||||||||
| 50 | |||||||||||
| 51 | __END__ | ||||||||||