CPAN::Forum
SOAP-Lite - basic pattern matching problem
| Posted on Wed May 23 14:55:48 2007 by tiredstudent |
| basic pattern matching problem |
|
Hi!
I have spent too many hours trying to work this out. Can anyone help?
I'm simply trying to set up two simple operations on a SOAP::Lite server.
I need to convert an input string to upper case if any lower case characters are found.
The second operation needs to perform the opposite: convert a string to lower case if upper case characters found. Here's the code:
use SOAP::Lite;
use SOAP::Transport::HTTP ;
my $port = shift ;
my $soapServer = SOAP::Transport::HTTP::Daemon
-> new (LocalPort => $port )
-> dispatch_to ( qw(echoString) )
-> on_action ( sub {
die "SOAPAction should be \"http://soapinterop.org/\"\n"
unless $_[0] eq '"http://soapinterop.org/"';} ) ;
print "Starting SOAP server on URL: ".$soapServer->url."\n" ;
$soapServer->handle;
sub echoString {
# Receives a string and echoes it back
my ($class, $inputString) = @_ ;
die "no input provided\n" if !$inputString ;
$inputString =~ tr/A-Z/a-z/ if $inputString =~ m/[A-Z]/ ;
$inputString =~ tr/a-z/A-Z/ if $inputString =~ m/[a-z]/ ;
return SOAP::Data->name('return')->type('string')->value($inputString);
}
The code gives the following error on the command line:
Use of uninitialized value in pattern match (m//) at /usr/local/lib/perl5/site_perl/5.8.0/SOAP/Lite.pm line 429.
proxy: transport protocol not specified
Any help would be much appreciated! :)
|
| Direct Responses: 5239 | Write a response |
(9)
]