API-Handle

 view release on metacpan or  search on metacpan

lib/API/Handle.pm  view on Meta::CPAN

		when ( 'HASH' ) {
			for my $key ( keys %{ $ref } ) {
				my $val = $ref->{ $key };
				$self->_tied( ref => $ref, key => $key ) if grep { ref $val eq $_ } qw/ARRAY HASH REF/;
			}
		}
	}

	if ( $tied ) {
		tie my %hash, 'Tie::Hash::Indexed';

		for ( ref $ref ) {
			when ( 'ARRAY' ) {
				@array = @{ $ref };
			}
			when ( 'REF' ) {
				@array = @{ ${ $ref } };
			}
		}

		%hash = @array;

		for ( ref $args{ref} ) {
			when ( 'HASH' ) {
				$args{ref}->{ $args{key} } = \%hash;
			}
			when ( 'ARRAY' ) {
				$args{ref}->[ $args{index} ] = \%hash;
			}
			when ( 'REF' ) {
				${ $args{ref} }->[ $args{index} ] = \%hash;
			}
		}
	}
}

1;

__END__

=pod

=head1 NAME

API::Handle

=head1 VERSION

version 0.02

=head3 _tied

Recursively tie \[ key => $val, key => $val, ... ] data to create preserved-order hashes ( needed for SOAP ).

=head1 AUTHOR

Nour Sharabash <amirite@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Nour Sharabash.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 0.571 second using v1.01-cache-2.11-cpan-bbcb1afb8fc )