line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SWISH::API::Remote::MetaName; |
2
|
3
|
|
|
3
|
|
15
|
use URI::Escape; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
192
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
############################################ |
5
|
|
|
|
|
|
|
# an object basically encapsulating a list of [Name, Id, Type] |
6
|
|
|
|
|
|
|
# and offering methods of the same name to access them. |
7
|
3
|
|
|
3
|
|
16
|
use fields qw( Name Id Type ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
16
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
############################################ |
10
|
|
|
|
|
|
|
sub new { |
11
|
0
|
|
|
0
|
0
|
|
my SWISH::API::Remote::MetaName $self = shift; |
12
|
0
|
0
|
|
|
|
|
unless (ref $self) { |
13
|
0
|
|
|
|
|
|
$self = fields::new($self); |
14
|
|
|
|
|
|
|
} |
15
|
0
|
|
|
|
|
|
return $self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
############################################ |
19
|
|
|
|
|
|
|
# Parse_MetaNames_From_Query_String( $line ) |
20
|
|
|
|
|
|
|
# returns A LIST of MetaName objects (which also are used to describe Properties) |
21
|
|
|
|
|
|
|
sub Parse_MetaNames_From_Query_String { |
22
|
0
|
|
|
0
|
0
|
|
my $line = shift; |
23
|
0
|
|
|
|
|
|
my @parts = split ( /&/, $line ); |
24
|
0
|
|
|
|
|
|
my @toreturn; |
25
|
0
|
|
|
|
|
|
for my $p (@parts) { |
26
|
0
|
|
|
|
|
|
my ( $id, $v ) = split ( /=/, $p, 2 ); |
27
|
0
|
|
|
|
|
|
my ( $name, $type ) = split(',', uri_unescape($v), 2); |
28
|
0
|
|
|
|
|
|
my $newobj = new SWISH::API::Remote::MetaName; |
29
|
0
|
|
|
|
|
|
$newobj->{Id} = $id; |
30
|
0
|
|
|
|
|
|
$newobj->{Name} = $name; |
31
|
0
|
|
|
|
|
|
$newobj->{Type} = $type; |
32
|
0
|
|
|
|
|
|
push(@toreturn, $newobj); |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
|
return @toreturn; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
############################################ |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
# $self->Name(), $self->Id(), and $self->Type() |
40
|
|
|
|
|
|
|
# return the corresponding values from $self |
41
|
|
|
|
|
|
|
# Note: why not let user reset value. We might as well use FunctionGenerator. TODO. |
42
|
|
|
|
|
|
|
# |
43
|
0
|
0
|
|
0
|
0
|
|
sub Name { my $s = shift; return $s->{Name} or die "$0: no Name"; } # only for reading |
|
0
|
|
|
|
|
|
|
44
|
0
|
0
|
|
0
|
0
|
|
sub Id { my $s = shift; return $s->{Id} or die "$0: no Id"; } # only for reading |
|
0
|
|
|
|
|
|
|
45
|
0
|
0
|
|
0
|
0
|
|
sub Type { my $s = shift; return $s->{Type} or die "$0: no Type"; } # only for reading |
|
0
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
############################################ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|