In order to return an error/fault from a stand-alone package in SOAP:Lite context, you have to die. Because your function(s) are being eval-ed, the parent SOAP handler catches $@ and fobs it off on a fault widget. If you're like me, you will eventually notice that all your error messages end in :

at /path/to/some/ line 123.

and be annoyed. Annoyed because this is not information a user needs to see in a web services context and annoyed because it makes your error messages ugly. You will be further annoyed because you're not sure which of the two issues bothers you more. Since I've just spent time I could be sleeping figuring out a solution, I thought I would share it with people so that they may continue to get enough sleep and tackle bigger, more important, problems.

package My::XMLRPC::Service;

use strict;

# The example assumes a CGI widget that provides

# XMLRPC services. Since XMLRPC::Lite mostly just

# inherits from SOAP::Lite, the following should

# also work for a SOAP server, but you would need

# to subclass SOAP::Transport::HTTP::Server instead


use vars qw (@ISA);

@ISA = qw (XMLRPC::Lite::Transport::HTTP::CGI);

use XMLRPC::Lite::Transport::HTTP;

sub make_fault {

    my $self = shift;

    my @args = @_;

    # this is a decidedly lazy regex(p) but

    # you're not supposed to have spaces in

    # unix filenames anyway, so there you go...

    $args[1] =~ s/^(.*)\sat\s([^\s]+)\sline\s(\d+)(.*)$/$1/m;



return 1;

Your mileage may vary. Update : People with sleep will correctly point out that:
a slightly easier way to get rid of the "at xxx line xxx" is just to put a carriage return at the end of your error message. Perl only tacks on the "at" message if there isn't a return.
Alas. In my own defense I can only say that I have also spent days covering vast expenses of page with tiny dots (specks, really) drawn with a teeny tiny mechinical pen. When asked why I didn't use Letratone, all I could ever answer was it doesn't look the same. Move along now, these are not the subclasses you are looking for.