| 1 | # | ||
| 2 | # Module Copyright (C) 2000 Ed Hill | ||
| 3 | # Documentation Copyright (C) 2000 Tim Peoples | ||
| 4 | # | ||
| 5 | # Apache::XMLRPC is free software; you can redistribute it | ||
| 6 | # and/or modify it under the same terms as Perl itself. | ||
| 7 | # | ||
| 8 | # $Id: XMLRPC.pm,v 1.2 2000/11/09 01:36:34 kmacleod Exp $ | ||
| 9 | # | ||
| 10 | |||
| 11 | package Apache::XMLRPC; | ||
| 12 | |||
| 13 | use Apache::Constants qw(:common); | ||
| 14 | use Frontier::RPC2; | ||
| 15 | |||
| 16 | sub handler { | ||
| 17 | my $r = shift; | ||
| 18 | |||
| 19 | my $conf = $r->server_root_relative( $r->dir_config( "XMLRPC_Config" ) ); | ||
| 20 | |||
| 21 | if( -f $conf ) { | ||
| 22 | unless( $rt = do $conf ) { | ||
| 23 | die "Couldn\'t parse conf file ($conf): $@\n" if $@; | ||
| 24 | die "Couldn\'t compile conf file ($conf): $!\n" unless defined $rt; | ||
| 25 | die "Couldn\'t run conf file ($conf)\n" unless $rt; | ||
| 26 | } | ||
| 27 | } | ||
| 28 | |||
| 29 | my $decoder = Frontier::RPC2->new(); | ||
| 30 | |||
| 31 | my $content; | ||
| 32 | $r->read( $content, $r->header_in( 'Content-length' ) ); | ||
| 33 | |||
| 34 | my $answer = $decoder->serve( $content, $Apache::XMLRPC::map ); | ||
| 35 | |||
| 36 | $r->send_http_header(); | ||
| 37 | $r->print($answer); | ||
| 38 | |||
| 39 | return OK; | ||
| 40 | } | ||
| 41 | |||
| 42 | 1; | ||
| 43 | |||
| 44 | __END__ |