line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SWISH::API::Remote::Header; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# SWISH::API::Remote::Header |
4
|
|
|
|
|
|
|
# object to encapsulate SWISH-E header data |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# rewritten from file originally from pek |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
105
|
|
9
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
73
|
|
10
|
3
|
|
|
3
|
|
14
|
use Carp; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
250
|
|
11
|
3
|
|
|
3
|
|
16
|
use URI::Escape; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
305
|
|
12
|
3
|
|
|
3
|
|
17
|
use SWISH::API::Remote::FunctionGenerator; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
80
|
|
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
3
|
|
15
|
use fields qw( Name Value ); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
16
|
|
15
|
|
|
|
|
|
|
# NOTE that there is no corresponding "SWISH::API::Header" to model, |
16
|
|
|
|
|
|
|
# so we write the interface to be similar to SWISH::API::MetaList |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
############################################ |
19
|
|
|
|
|
|
|
# SWISH::API::Remote::Header->new() |
20
|
|
|
|
|
|
|
# creates a new SWISH::API::Remote::Header object |
21
|
|
|
|
|
|
|
sub new { |
22
|
0
|
|
|
0
|
0
|
|
my SWISH::API::Remote::Header $self = shift; |
23
|
0
|
0
|
|
|
|
|
unless (ref $self) { |
24
|
0
|
|
|
|
|
|
$self = fields::new($self); |
25
|
|
|
|
|
|
|
} |
26
|
0
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
############################################ |
30
|
|
|
|
|
|
|
# Parse_MetaNames_From_Query_String( $line ) |
31
|
|
|
|
|
|
|
# given a string of Header objects (eg from swished) |
32
|
|
|
|
|
|
|
# returns A LIST of Header objects (which also are used to describe Properties) |
33
|
|
|
|
|
|
|
sub Parse_Headers_From_Query_String { |
34
|
0
|
|
|
0
|
0
|
|
my $line = shift; |
35
|
0
|
|
|
|
|
|
my @parts = split ( /&/, $line ); |
36
|
0
|
|
|
|
|
|
my @toreturn; |
37
|
0
|
|
|
|
|
|
for my $p (@parts) { |
38
|
0
|
|
|
|
|
|
my $newobj = new SWISH::API::Remote::Header; |
39
|
0
|
|
|
|
|
|
my ( $name, $v ) = split ( /=/, $p, 2 ); |
40
|
0
|
|
|
|
|
|
$newobj->{Name} = uri_unescape($name); |
41
|
0
|
|
|
|
|
|
$newobj->{Value} = uri_unescape($v); |
42
|
0
|
|
|
|
|
|
push(@toreturn, $newobj); |
43
|
|
|
|
|
|
|
} |
44
|
0
|
|
|
|
|
|
return @toreturn; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
############################################ |
48
|
|
|
|
|
|
|
# $self->Name() |
49
|
|
|
|
|
|
|
# returns the value of $self->{Name} |
50
|
0
|
0
|
|
0
|
1
|
|
sub Name { return $_[0]->{Name} or die "$0: no Name"; } # only for reading |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
############################################ |
53
|
|
|
|
|
|
|
# $self->Value() |
54
|
|
|
|
|
|
|
# returns the value of $self->{Value} |
55
|
0
|
0
|
|
0
|
1
|
|
sub Value { return $_[0]->{Value} or die "$0: no Value"; } # only for reading |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |