home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _4e5bec3321c413555ba54e82e72e3397 < prev    next >
Text File  |  2000-03-15  |  1KB  |  77 lines

  1. package SOAP::GenericHashSerializer;
  2.  
  3. use strict;
  4. use vars qw($VERSION);
  5. use SOAP::Defs;
  6.  
  7. $VERSION = '0.23';
  8.  
  9. sub new {
  10.     my ($class, $hash) = @_;
  11.     
  12.     my $self = {
  13.         hash => $hash,
  14.     };
  15.     bless $self, $class;
  16. }
  17.  
  18. my $g_intrusive_hash_keys = {
  19.     $soapperl_intrusive_hash_key_typeuri  => undef,
  20.     $soapperl_intrusive_hash_key_typename => undef,
  21. };
  22.  
  23. sub serialize {
  24.     my ($self, $stream) = @_;
  25.  
  26.     my $hash = $self->{hash};
  27.  
  28.     while (my ($k, $v) = each %$hash) {
  29.         next if exists $g_intrusive_hash_keys->{$k};
  30.         if (ref $v) {
  31.             $stream->reference_accessor(undef, $k, $v);
  32.         }
  33.         else {
  34.             $stream->simple_accessor(undef, $k, undef, undef, $v);
  35.         }
  36.     }
  37. }
  38.  
  39. sub get_typeinfo {
  40.     my $self = shift;
  41.     my $hash = $self->{hash};
  42.  
  43.     my $typeuri  = exists $hash->{$soapperl_intrusive_hash_key_typeuri} ?
  44.                           $hash->{$soapperl_intrusive_hash_key_typeuri} : undef;
  45.  
  46.     my $typename = exists $hash->{$soapperl_intrusive_hash_key_typename} ?
  47.                           $hash->{$soapperl_intrusive_hash_key_typename} : undef;
  48.  
  49.     ($typeuri, $typename);
  50. }
  51.  
  52. sub is_package {
  53.     0;
  54. }
  55.  
  56. sub get_accessor_type {
  57.     $soapperl_accessor_type_compound;
  58. }
  59.  
  60. 1;
  61. __END__
  62.  
  63.  
  64. =head1 NAME
  65.  
  66. SOAP::GenericHashSerializer - Generic serializer for Perl hashes
  67.  
  68. =head1 SYNOPSIS
  69.  
  70. =head1 DESCRIPTION
  71.  
  72. =head1 AUTHOR
  73.  
  74. Keith Brown
  75.  
  76. =cut
  77.