| 1 | package Net::OBEX::Packet::Request::Put; | ||||||||||
| 2 | |||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 7 | our $VERSION = '1.001002'; # VERSION | |||||||||
| 6 | 7 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 7 | ▶ | use base 'Net::OBEX::Packet::Request::Base'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | # opcodes 0x02 (0x82) | ||||||||||
| 11 | |||||||||||
| 12 | 2 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 13 | 2 | my $class = shift; | |||||||||
| 14 | 2 | ▶ | croak "Must have even number of arguments to new()" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | if @_ & 1; | ||||||||||
| 16 | 2 | my %args = @_; | |||||||||
| 17 | 2 | $args{ +lc } = delete $args{ $_ } for keys %args; | |||||||||
| 18 | |||||||||||
| 19 | 2 | %args = ( | |||||||||
| 20 | is_final => 0, | ||||||||||
| 21 | headers => [], | ||||||||||
| 22 | |||||||||||
| 23 | %args, | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | 2 | return bless \%args, $class; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 2 | ▶ | sub make { | ||||||||
|
Subroutine
make: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 30 | 2 | my $self = shift; | |||||||||
| 31 | |||||||||||
| 32 | 2 | ▶ | my $packet = $self->is_final() ? "\x82" : "\x02"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 2 | my $headers = join '', @{$self->headers}; | |||||||||
| 34 | 2 | $packet .= pack 'n', 3+length $headers; | |||||||||
| 35 | 2 | $packet .= $headers; | |||||||||
| 36 | |||||||||||
| 37 | 2 | return $self->raw($packet); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 2 | ▶ | sub is_final { | ||||||||
|
Subroutine
is_final: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 41 | 2 | my $self = shift; | |||||||||
| 42 | 2 | ▶ | if ( @_ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | $self->{ is_final } = shift; | |||||||||
| 44 | } | ||||||||||
| 45 | 2 | return $self->{ is_final }; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 7 | 1; | |||||||||
| 49 | |||||||||||
| 50 | __END__ | ||||||||||