#!/usr/bin/perl use strict; use warnings; { package Four51Listener; use HTTP::Server::Simple::CGI; use base qw( HTTP::Server::Simple::CGI ); use EGA::Utils qw( TimeStamp ); # a set of custom functions my %dispatch = ( '/toMFF' => \&toMFF, ); sub handle_request { my ( $self, $cgi ) = @_; my $path = $cgi->path_info(); my $handler = $dispatch{ $path }; if ( ref( $handler ) eq 'CODE' ) { $handler->( $cgi ); print $cgi->header( -type => 'text/xml', -charset => 'ascii' ), response_ok(); } } sub toMFF { my $cgi = shift; my $xml = $cgi->param( 'POSTDATA' ); } sub response_ok { my $timestamp = TimeStamp(); $timestamp =~ s/\s/T/; my $response = < EOF return $response; } } my $pid = Four51Listener->new(8888)->background(); print "Kill $pid to stop server.\n";