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

5957Basic pattern matching question

Expand Messages
  • guylill
    May 23, 2007
    • 0 Attachment
      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:

      1) I need to convert an input string to upper case if any lower case
      characters are found.

      2) 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/
      unless $_[0] eq '"http://soapinterop.org/"';} ) ;

      print "Starting SOAP server on URL: ".$soapServer->url."\n" ;

      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

      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! :)
    • Show all 2 messages in this topic