runningwithscissors has asked for the wisdom of the Perl Monks concerning the following question:

I am running ActivePerl 5.10.1 Build 1007 on Windows XP, and I have SOAP-Lite 0.712 installed.

When I try to execute the following code:

use SOAP::Transport::TCP; my $daemon = SOAP::Transport::TCP::Server->new(LocalAddr => '192.16 +8.1.15', LocalPort => 4200, Listen => 5, Reuse => 1); $daemon->dispatch_to('Hello'); print "SOAP TCP server listening...\n"; print " Host: ", $daemon->sockhost, "\n"; print " Port: ", $daemon->sockport, "\n"; $daemon->handle(); package Hello; sub hello { shift; return "Hello " . shift; }

I get the following error: Can't locate object method "new" via package "SOAP::Transport::TCP::Server" at C :/Perl/site/lib/SOAP/Transport/TCP.pm line 169.

The line in question is: $self = $class->SUPER::new(@methods);

I have tried reinstalling the module, but to no avail.

Any help or insight would be greatly appreciated.

Replies are listed 'Best First'.
Re: Problem with SOAP::Transport::TCP
by mr_mischief (Monsignor) on Sep 01, 2010 at 02:53 UTC

    Put this line before what you have:

    Use SOAP::Lite;

    The SOAP::Lite transport modules all (or mostly anyway) inherit from classes declared in SOAP::Lite itself. SOAP::Transport::TCP::Server inherits from SOAP::Server which is in the SOAP::Lite main module.

    The docs actually say this about the inheritance, but they assume you know that means you must load the parent class explicitly.

    Update: fixed a typo.

      That was it. Thanks so much for your help. I knew it had to be something silly I was missing.

      Interestingly, the code works as is on another box that has an older version of SOAP::Lite installed.

        It's possible that the derived class uses the parent class in the older version and that the authors decided to change that. Let's do some historical research on the module.

        I don't find anything in the CHANGES file about that, but I just did a few quick string searches for what seemed obvious to me and didn't read the whole thing. Your searches might turn something up from that source if you look.

        Here it is though: version 0.70_08 of SOAP::Transport::TCP does include a use SOAP::Lite; statement. I'm not sure which version was the last to do that, but now we have confirmed that at least one previous version did. If it was necessary, the svn repository or the web interface to it would make it fairly easy to find out when the change occurred.

Re: Problem with SOAP::Transport::TCP
by aquarium (Curate) on Sep 01, 2010 at 00:58 UTC
    Are you missing a dependency module?...as the line 169 is calling the parent constructor to create instance of the SOAP::Transport::TCP::Server object. Check the package dependencies.
    the hardest line to type correctly is: stty erase ^H

      The parent class is part of the same distribution package in this case. The problem is that the parent class is in another module in the same package which is not automatically used. It must be explicitly used by the program.

      ( I guess there could also be some damage to the installed distribution, but let's trust Occam and solve the apparent problem first and see if something else rears it head after the initial fix. )