| 1 | package SOAPjr::base; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | =head1 NAME | ||||||||||||
| 7 | |||||||||||||
| 8 | SOAPjr::base - base class for SOAPjr objects | ||||||||||||
| 9 | |||||||||||||
| 10 | =head1 VERSION | ||||||||||||
| 11 | |||||||||||||
| 12 | Version 1.0.1 | ||||||||||||
| 13 | |||||||||||||
| 14 | =cut | ||||||||||||
| 15 | |||||||||||||
| 16 | 1 | our $VERSION = "1.0.1"; | |||||||||||
| 17 | |||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||
| 19 | |||||||||||||
| 20 | See perldoc SOAPjr for more info. | ||||||||||||
| 21 | |||||||||||||
| 22 | =cut | ||||||||||||
| 23 | |||||||||||||
| 24 | 1 | ▶ | use JSON; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 25 | 1 | $JSON::UnMapping = 1; | |||||||||||
| 26 | |||||||||||||
| 27 | 0 | ▶ | sub new { | ||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 28 | 0 | my $self = {}; | |||||||||||
| 29 | 0 | my $class = shift; | |||||||||||
| 30 | 0 | bless $self, $class; | |||||||||||
| 31 | 0 | $self->{_data} = {}; | |||||||||||
| 32 | $self->{MOBject_structure} = { | ||||||||||||
| 33 | 0 | ENVELOPE => 1, | |||||||||||
| 34 | BODY => 1, | ||||||||||||
| 35 | HEAD => 1, | ||||||||||||
| 36 | OPTIONS => 1 | ||||||||||||
| 37 | }; | ||||||||||||
| 38 | 0 | $self->{json} = JSON->new(); | |||||||||||
| 39 | 0 | return $self->_init(@_); | |||||||||||
| 40 | } | ||||||||||||
| 41 | |||||||||||||
| 42 | 0 | ▶ | sub _init { | ||||||||||
|
Subroutine
_init: not called CC=1 SCAR=6.9
| |||||||||||||
| 43 | 0 | my $self = shift; | |||||||||||
| 44 | 0 | return $self; | |||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | 0 | ▶ | sub set { | ||||||||||
|
Subroutine
set: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||
| 48 | 0 | my $self = shift; | |||||||||||
| 49 | 0 | ▶ | my $input = shift || undef; | ||||||||||
|
Condition0%0/2
shift() || undef
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 50 | 0 | my $count = shift; | |||||||||||
| 51 | |||||||||||||
| 52 | 0 | ▶ | if ($input) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 53 | 0 | foreach my $structure ( keys %{ $self->{MOBject_structure} } ) { | |||||||||||
| 54 | 0 | ▶ | if ( exists $input->{$structure} ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 55 | 0 | ▶ | if (ref($input->{$structure}) eq 'HASH') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 56 | 0 | foreach my $item ( keys %{ $input->{$structure} } ) { | |||||||||||
| 57 | $self->{_data}->{$structure}->{$item} = | ||||||||||||
| 58 | 0 | $input->{$structure}->{$item}; | |||||||||||
| 59 | 0 | $count++; | |||||||||||
| 60 | } | ||||||||||||
| 61 | } else { | ||||||||||||
| 62 | 0 | $self->{_data}->{$structure} = $input->{$structure}; | |||||||||||
| 63 | 0 | $count++; | |||||||||||
| 64 | } | ||||||||||||
| 65 | } | ||||||||||||
| 66 | } | ||||||||||||
| 67 | } | ||||||||||||
| 68 | |||||||||||||
| 69 | 0 | return $count; | |||||||||||
| 70 | } | ||||||||||||
| 71 | |||||||||||||
| 72 | 0 | ▶ | sub get { | ||||||||||
|
Subroutine
get: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||
| 73 | 0 | my $self = shift; | |||||||||||
| 74 | 0 | ▶ | my $param = shift || undef; | ||||||||||
|
Condition0%0/2
shift() || undef
MC/DC0%0/1
shift() || undef
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 75 | 0 | ▶ | if ($param) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 76 | 0 | ▶ | if ( $self->{_data}->{$param} ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 77 | 0 | return $self->{_data}->{$param}; | |||||||||||
| 78 | } else { | ||||||||||||
| 79 | 0 | return {}; | |||||||||||
| 80 | } | ||||||||||||
| 81 | } else { | ||||||||||||
| 82 | 0 | return $self->{_data}; | |||||||||||
| 83 | } | ||||||||||||
| 84 | } | ||||||||||||
| 85 | |||||||||||||
| 86 | 0 | ▶ | sub set_all { | ||||||||||
|
Subroutine
set_all: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 87 | 0 | my $self = shift; | |||||||||||
| 88 | 0 | my $input = shift; | |||||||||||
| 89 | 0 | ▶ | if ($input) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 90 | 0 | $self->{_data} = $input; | |||||||||||
| 91 | 0 | return 1; | |||||||||||
| 92 | } else { | ||||||||||||
| 93 | 0 | return 0; | |||||||||||
| 94 | } | ||||||||||||
| 95 | } | ||||||||||||
| 96 | |||||||||||||
| 97 | =head1 AUTHOR | ||||||||||||
| 98 | |||||||||||||
| 99 | Rob Manson, <robman[at]cpan.org> | ||||||||||||
| 100 | |||||||||||||
| 101 | =head1 BUGS | ||||||||||||
| 102 | |||||||||||||
| 103 | Please report any bugs or feature requests to C<bug-soapjr at rt.cpan.org>, or through | ||||||||||||
| 104 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SOAPjr>. I will be notified, and then you'll | ||||||||||||
| 105 | automatically be notified of progress on your bug as I make changes. | ||||||||||||
| 106 | |||||||||||||
| 107 | |||||||||||||
| 108 | |||||||||||||
| 109 | |||||||||||||
| 110 | =head1 SUPPORT | ||||||||||||
| 111 | |||||||||||||
| 112 | You can find documentation for this module with the perldoc command. | ||||||||||||
| 113 | |||||||||||||
| 114 | perldoc SOAPjr | ||||||||||||
| 115 | |||||||||||||
| 116 | |||||||||||||
| 117 | You can also look for information at: | ||||||||||||
| 118 | |||||||||||||
| 119 | =over 4 | ||||||||||||
| 120 | |||||||||||||
| 121 | =item * SOAPjr.org | ||||||||||||
| 122 | |||||||||||||
| 123 | L<http://SOAPjr.org> | ||||||||||||
| 124 | |||||||||||||
| 125 | =item * RT: CPAN's request tracker | ||||||||||||
| 126 | |||||||||||||
| 127 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=SOAPjr> | ||||||||||||
| 128 | |||||||||||||
| 129 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||
| 130 | |||||||||||||
| 131 | L<http://annocpan.org/dist/SOAPjr> | ||||||||||||
| 132 | |||||||||||||
| 133 | =item * CPAN Ratings | ||||||||||||
| 134 | |||||||||||||
| 135 | L<http://cpanratings.perl.org/d/SOAPjr> | ||||||||||||
| 136 | |||||||||||||
| 137 | =item * Search CPAN | ||||||||||||
| 138 | |||||||||||||
| 139 | L<http://search.cpan.org/dist/SOAPjr/> | ||||||||||||
| 140 | |||||||||||||
| 141 | =back | ||||||||||||
| 142 | |||||||||||||
| 143 | =head1 ACKNOWLEDGEMENTS | ||||||||||||
| 144 | |||||||||||||
| 145 | See L<http://SOAPjr.org/specs.html> for further information on related RFC's and specifications. | ||||||||||||
| 146 | |||||||||||||
| 147 | =head1 COPYRIGHT & LICENSE | ||||||||||||
| 148 | |||||||||||||
| 149 | Copyright 2008 Rob Manson, Sean McCarthy and http://SOAPjr.org, some rights reserved. | ||||||||||||
| 150 | |||||||||||||
| 151 | This file is part of SOAPjr. | ||||||||||||
| 152 | |||||||||||||
| 153 | SOAPjr is free software: you can redistribute it and/or modify | ||||||||||||
| 154 | it under the terms of the GNU General Public License as published by | ||||||||||||
| 155 | the Free Software Foundation, either version 3 of the License, or | ||||||||||||
| 156 | (at your option) any later version. | ||||||||||||
| 157 | |||||||||||||
| 158 | SOAPjr is distributed in the hope that it will be useful, | ||||||||||||
| 159 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||
| 160 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||
| 161 | GNU General Public License for more details. | ||||||||||||
| 162 | |||||||||||||
| 163 | You should have received a copy of the GNU General Public License | ||||||||||||
| 164 | along with SOAPjr. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||
| 165 | |||||||||||||
| 166 | =cut | ||||||||||||
| 167 | |||||||||||||
| 168 | 1 | 1; | |||||||||||