line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
2
|
|
|
|
|
|
|
use Moo; |
3
|
4
|
|
|
4
|
|
1531
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
17
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: A ValidSign object in use for the API |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Types::Standard qw(Str); |
7
|
4
|
|
|
4
|
|
1066
|
use String::CamelSnakeKebab qw(lower_camel_case lower_snake_case); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
20
|
|
8
|
4
|
|
|
4
|
|
2805
|
|
|
4
|
|
|
|
|
42986
|
|
|
4
|
|
|
|
|
19
|
|
9
|
|
|
|
|
|
|
has id => ( |
10
|
|
|
|
|
|
|
is => 'rw', |
11
|
|
|
|
|
|
|
isa => Str, |
12
|
|
|
|
|
|
|
predicate => 'has_id' |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has type => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
isa => Str, |
18
|
|
|
|
|
|
|
required => 1, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
around BUILDARGS => sub { |
22
|
|
|
|
|
|
|
my $orig = shift; |
23
|
|
|
|
|
|
|
my $class = shift; |
24
|
|
|
|
|
|
|
my %args = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return $orig->($class, |
27
|
|
|
|
|
|
|
map { lower_snake_case($_) => $args{$_} } keys %args); |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
my $meta = $self->meta; |
32
|
8
|
|
|
8
|
0
|
680
|
my %result; |
33
|
8
|
|
|
|
|
47
|
for my $attr ($meta->get_all_attributes) { |
34
|
8
|
|
|
|
|
79
|
my $name = $attr->name; |
35
|
8
|
|
|
|
|
59
|
my $value = $attr->get_value($self); |
36
|
61
|
|
|
|
|
953520
|
my $type = $attr->type_constraint; |
37
|
61
|
|
|
|
|
150
|
|
38
|
61
|
|
|
|
|
7806
|
if ($type) { |
39
|
|
|
|
|
|
|
if ($type->equals('Bool')) { |
40
|
61
|
100
|
|
|
|
441
|
$value = $value ? \1 : \0; |
41
|
48
|
100
|
|
|
|
241
|
} |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
42
|
7
|
100
|
|
|
|
668
|
elsif ($type->equals('ArrayRef')) { |
43
|
|
|
|
|
|
|
$value = undef if !@$value; |
44
|
|
|
|
|
|
|
} |
45
|
8
|
100
|
|
|
|
1899
|
elsif ($type->equals('HashRef')) { |
46
|
|
|
|
|
|
|
$value = undef if !keys %$value; |
47
|
|
|
|
|
|
|
} |
48
|
0
|
0
|
|
|
|
0
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
if (defined $value) { |
51
|
|
|
|
|
|
|
$name = lower_camel_case($name); |
52
|
61
|
100
|
|
|
|
12643
|
$result{$name} = $value if defined $value; |
53
|
30
|
|
|
|
|
74
|
} |
54
|
30
|
50
|
|
|
|
778
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
return \%result; |
57
|
|
|
|
|
|
|
} |
58
|
8
|
|
|
|
|
124
|
|
59
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=pod |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=encoding UTF-8 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
WebService::ValidSign::Object - A ValidSign object in use for the API |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 VERSION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
version 0.004 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Wesley Schwengle. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is free software, licensed under: |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
The (three-clause) BSD License |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |