Loading ...
Sorry, an error occurred while loading the content.

2568turn off the warning "as_string was redefined"

Expand Messages
  • Masayoshi Sekimura
    May 1, 2003
    • 0 Attachment
      Hi all,

      I know a way of to create my own as_string is:

      package My::Deserializer;
      sub as_string {
      shift;
      require Jcode;
      return Jcode->new(shift, 'utf8')->euc;
      }

      *SOAP::XMLSchema1999::Deserializer::as_string =
      \&My::Deserializer::as_string;

      but it cause the warning as follows:

      "Subroutine SOAP::XMLSchema1999::Deserializer::as_string redefined"

      now I find a way without this warning. Isn't this a wrong way? 

      Thanks for any comments.

      ----
      Masayoshi Sekimura <sekimura@...>


      use SOAP::Transport::HTTP;

      BEGIN {
      package My::XMLSchema1999::Deserializer;
      @ISA = qw(SOAP::XMLSchema1999::Deserializer);
      sub as_string {
      my $self = shift;
      my $string = $self->SUPER::as_string(@_);
      utf8::downgrade($string);
      return $string;
      }

      package My::Deserializer;
      @ISA = qw(SOAP::Deserializer);
      sub new {
      my $class = shift;
      my $self = $class->SUPER::new(@_);
      my $schemas = $self->{_xmlschemas};
      $schemas->{'http://www.w3.org/1999/XMLSchema'}
      = 'My::XMLSchema1999::Deserializer';
      return $self;
      }
      }

      my $daemon = SOAP::Transport::HTTP::Daemon
      -> new (LocalAddr => 'localhost', LocalPort => 8000)
      -> dispatch_to('/home/sekimura/work/soap_lite/Modules', 'MyTest')
      -> options({compress_threshold => 10000})
      -> deserializer(My::Deserializer->new)
      ;


      print "Contact to SOAP server at ", $daemon->url, "\n";
      $daemon->handle;
    • Show all 3 messages in this topic