line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Net::OBEX::Packet::Headers::Unicode; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
53772
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
101
|
|
5
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
80
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
14
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
194
|
|
8
|
3
|
|
|
3
|
|
2061
|
use Encode qw(encode_utf8); |
|
3
|
|
|
|
|
27482
|
|
|
3
|
|
|
|
|
300
|
|
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
25
|
use base 'Net::OBEX::Packet::Headers::Base'; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
3603
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '1.001001'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my %Header_HI_For = ( |
15
|
|
|
|
|
|
|
name => "\x01", |
16
|
|
|
|
|
|
|
description => "\x05", |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
20
|
2
|
|
|
2
|
1
|
4
|
my ( $class, $name, $value ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
2
|
50
|
|
|
|
6
|
croak "Missing header name or HI identifier" |
23
|
|
|
|
|
|
|
unless defined $name; |
24
|
|
|
|
|
|
|
|
25
|
2
|
50
|
|
|
|
8
|
$name = $Header_HI_For{ lc $name } |
26
|
|
|
|
|
|
|
if exists $Header_HI_For{ lc $name }; |
27
|
|
|
|
|
|
|
|
28
|
2
|
50
|
|
|
|
5
|
$value = '' |
29
|
|
|
|
|
|
|
unless defined $value; |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
13
|
return bless { |
32
|
|
|
|
|
|
|
value => $value, |
33
|
|
|
|
|
|
|
hi => $name, |
34
|
|
|
|
|
|
|
}, $class; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub make { |
38
|
2
|
|
|
2
|
1
|
11
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
11
|
my $value = $self->value; |
41
|
2
|
50
|
|
|
|
6
|
unless ( length $value ) { |
42
|
0
|
|
|
|
|
0
|
return $self->hi . "\x00\x03"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
8
|
$value = pack 'n*', unpack 'U*', encode_utf8($value); |
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
|
|
32
|
my $header = $self->hi; # header code |
48
|
2
|
|
|
|
|
6
|
$header .= pack 'n', 4 + length $value; |
49
|
2
|
|
|
|
|
4
|
$header .= $value . "\x00"; |
50
|
2
|
|
|
|
|
7
|
return $self->header($header); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |