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

Hi all,

I'm hoping one of you kind souls can point out where, exactly, I'm being a bit dim, as the problem I have, well it just has to be something really simple, but I just can't see it...

I have a SOAP server:

#!/usr/local/bin/perl use strict; use warnings; use SOAP::Transport::HTTP; $|++; my $daemon = SOAP::Transport::HTTP::Daemon -> new( LocalAddr => 'localhost', LocalPort => 8080, R +euse => 1 ) -> dispatch_to('/Users/johno/Code/DCI/Wordbank-DCI-Ser +ver/lib'); print STDERR "SOAP server startup at ", $daemon->url, "\nServer INC:", + join(' ', @INC), "\n"; $daemon->handle;

...which is called from the following client:

#!/usr/local/bin/perl use strict; use warnings; #use SOAP::Lite +trace => ['all', '-transport']; use SOAP::Lite; my $soap = SOAP::Lite->new( uri => 'http://DCI/Wordbank::DCI::Server', proxy => '', on_fault => sub { my($soap, $res) = @_; die ref $res ? $res->faultdetail : $soap->tran +sport->status, "\n"; }); print $soap->hello()->result, "\n";

...and the server calls the following module:

package Wordbank::DCI::Server; use vars qw(@ISA); @ISA = qw(SOAP::Server::Parameters); use strict; use warnings; use Carp; sub hello { my $self = shift; print STDERR 'Module INC: ', join(' ', @INC), "\n"; return "Hello, world\n"; } 1;

All of which works perfectly, calls the hello method, and prints out quite a reasonable @INC value. Until I add in use Data::Dumper immediately after the use Carp line in the module, at which point I get the following (excerpted) error when I turn tracing on:

<soap:Fault><faultcode>soap:Client</faultcode><faultstring>Failed to a +ccess class (Wordbank::DCI::Server): Can't locate Data/ in @ +INC (@INC contains: /Users/johno/Code/DCI/Wordbank-DCI-Server/lib) at + /Users/johno/Code/DCI/Wordbank-DCI-Server/lib/Wordbank/DCI/ + line 9. BEGIN failed--compilation aborted at /Users/johno/Code/DCI/Wordbank-DC +I-Server/lib/Wordbank/DCI/ line 9. Compilation failed in require at (eval 98) line 3. </faultstring><faultactor>http://localhost:8080/</faultactor></soap:Fa +ult>

...i.e. it appears that @INC is getting zapped to only contain the current module's directory. I can't even use lib... something to get around it as it can't use 'lib'.

Can anyone reproduce this? Am I being a complete klutz? Hay-ulp...

(OSX 10.4.8, Perl 5.8.8, SOAP::Lite 0.69)


Thanks to both almut and Ultra for both speedy and accurate replies.