1#!/usr/bin/env perl 2 3# -- XMLRPC::Lite -- services.soaplite.com -- Copyright (C) 2001 Paul Kulchenko -- 4 5use XMLRPC::Transport::HTTP; 6 7XMLRPC::Transport::HTTP::CGI 8 -> dispatch_to('validator1') 9 -> handle 10; 11 12package validator1; 13 14sub whichToolkit { shift if UNIVERSAL::isa($_[0] => __PACKAGE__); 15 return +{ 16 toolkitDocsUrl => 'http://www.soaplite.com/', 17 toolkitName => 'XMLRPC::Lite', 18 toolkitVersion => XMLRPC::Lite->VERSION, 19 toolkitOperatingSystem => $^O, 20 } 21} 22 23sub countTheEntities { shift if UNIVERSAL::isa($_[0] => __PACKAGE__); 24 my $string = shift; 25 my $res; 26 $res->{ctLeftAngleBrackets} = ($string =~ s/<//g) || 0; 27 $res->{ctRightAngleBrackets} = ($string =~ s/>//g) || 0; 28 $res->{ctAmpersands} = ($string =~ s/&//g) || 0; 29 $res->{ctApostrophes} = ($string =~ s/'//g) || 0; 30 $res->{ctQuotes} = ($string =~ s/"//g) || 0; 31 return $res; 32} 33 34sub arrayOfStructsTest { shift if UNIVERSAL::isa($_[0] => __PACKAGE__); 35 my $array = shift; 36 my $curly_sum = 0; 37 for my $struct (@$array) { 38 $curly_sum += $struct->{'curly'}; 39 } 40 return $curly_sum; 41} 42 43sub easyStructTest { shift if UNIVERSAL::isa($_[0] => __PACKAGE__); 44 my $struct = shift; 45 return $struct->{'moe'} + $struct->{'larry'} + $struct->{'curly'}; 46} 47 48sub echoStructTest { shift if UNIVERSAL::isa($_[0] => __PACKAGE__); 49 return shift; 50} 51 52sub manyTypesTest { shift if UNIVERSAL::isa($_[0] => __PACKAGE__); 53 return [@_]; 54} 55 56sub moderateSizeArrayCheck { shift if UNIVERSAL::isa($_[0] => __PACKAGE__); 57 my $array = shift; 58 return join('', $array->[0], $array->[-1]); 59} 60 61sub nestedStructTest { shift if UNIVERSAL::isa($_[0] => __PACKAGE__); 62 my $calendar = shift; 63 my $april_1_2000 = $calendar->{'2000'}{'04'}{'01'}; 64 return ($april_1_2000->{moe} + $april_1_2000->{larry} 65 + $april_1_2000->{curly}); 66} 67 68sub simpleStructReturnTest { shift if UNIVERSAL::isa($_[0] => __PACKAGE__); 69 my $number = shift; 70 return +{ 71 times10 => $number * 10, 72 times100 => $number * 100, 73 times1000 => $number * 1000 74 }; 75} 76