package SOAPjr::base; use strict; use warnings; =head1 NAME SOAPjr::base - base class for SOAPjr objects =head1 VERSION Version 1.0.1 =cut our $VERSION = "1.0.1"; =head1 SYNOPSIS See perldoc SOAPjr for more info. =cut use JSON; $JSON::UnMapping = 1; sub new { my $self = {}; my $class = shift; bless $self, $class; $self->{_data} = {}; $self->{MOBject_structure} = { ENVELOPE => 1, BODY => 1, HEAD => 1, OPTIONS => 1 }; $self->{json} = JSON->new(); return $self->_init(@_); } sub _init { my $self = shift; return $self; } sub set { my $self = shift; my $input = shift || undef; my $count = shift; if ($input) { foreach my $structure ( keys %{ $self->{MOBject_structure} } ) { if ( exists $input->{$structure} ) { if (ref($input->{$structure}) eq 'HASH') { foreach my $item ( keys %{ $input->{$structure} } ) { $self->{_data}->{$structure}->{$item} = $input->{$structure}->{$item}; $count++; } } else { $self->{_data}->{$structure} = $input->{$structure}; $count++; } } } } return $count; } sub get { my $self = shift; my $param = shift || undef; if ($param) { if ( $self->{_data}->{$param} ) { return $self->{_data}->{$param}; } else { return {}; } } else { return $self->{_data}; } } sub set_all { my $self = shift; my $input = shift; if ($input) { $self->{_data} = $input; return 1; } else { return 0; } } =head1 AUTHOR Rob Manson, =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc SOAPjr You can also look for information at: =over 4 =item * SOAPjr.org L =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 ACKNOWLEDGEMENTS See L for further information on related RFC's and specifications. =head1 COPYRIGHT & LICENSE Copyright 2008 Rob Manson, Sean McCarthy and http://SOAPjr.org, some rights reserved. This file is part of SOAPjr. SOAPjr is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SOAPjr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SOAPjr. If not, see . =cut 1;