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

turn off the warning "as_string was redefined"

Expand Messages
  • Masayoshi Sekimura
    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; }
    Message 1 of 3 , May 1, 2003
    View Source
    • 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;
    • Randy J. Ray
      ... Are you running with -w (warning enabled)? If so, you can wrap the above assignment in a block and temporarily turn off warnings: { local $^W = 0;
      Message 2 of 3 , May 1, 2003
      View Source
      • 0 Attachment
        On Thu, May 01, 2003 at 04:38:47PM +0900, Masayoshi Sekimura wrote:
        > 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"

        Are you running with "-w" (warning enabled)? If so, you can wrap the above
        assignment in a block and temporarily turn off warnings:

        {
        local $^W = 0;
        *SOAP::XMLSchema1999::Deserializer::as_string =
        \&My::Deserializer::as_string;
        }

        Randy
        --
        rjray@... Linux: Because rebooting is for adding new hardware.

        Any spammers auto-extracting addresses from this message will definitely want
        to include uce@... and report@...
      • 関村 昌義
        From: Randy J. Ray Subject: Re: [soaplite] turn off the warning as_string was redefined Date: Thu, 1 May 2003 14:09:14 -0700 ... Hi
        Message 3 of 3 , May 1, 2003
        View Source
        • 0 Attachment
          From: "Randy J. Ray" <rjray@...>
          Subject: Re: [soaplite] turn off the warning "as_string was redefined"
          Date: Thu, 1 May 2003 14:09:14 -0700

          > On Thu, May 01, 2003 at 04:38:47PM +0900, Masayoshi Sekimura wrote:
          > > but it cause the warning as follows:
          > >
          > > "Subroutine SOAP::XMLSchema1999::Deserializer::as_string redefined"
          >
          > Are you running with "-w" (warning enabled)? If so, you can wrap the above
          > assignment in a block and temporarily turn off warnings:

          Hi Randy,

          thanks for your information.
          Here is new BEGIN block that is so simple and has no warnings:

          BEGIN {
          {
          no warnings;
          *SOAP::XMLSchema1999::Deserializer::as_string =
          \&My::Deserializer::as_string;
          }
          package My::Deserializer;
          sub as_stirng {
          ...
          }
          }

          ----
          Masayoshi Sekimura <sekimura@...>
        Your message has been successfully submitted and would be delivered to recipients shortly.