4519l1

Listing 1: Caps.pm, the Perl module that serves as our SOAP
"endpoint."

package Text::Caps;

use strict;
use diagnostics;     # Turn off in production code

# capitalize expects to receive one argument.
# It returns that
# argument, capitalized, using Perl's
# built-in capitalization (uc)
# function.

sub capitalize
{
    my $self = shift;
    my $word = shift;

    return uc ($word);
}

# capitalize_array expects to receive a
# list of arguments.  The
# subroutine returns a list corresponding to
# the input list, except
# that each element has been capitalized.

sub capitalize_array
{
    my $self = shift;
    my @words = @_;

    return [map {uc $_} @words];
}

1;