package MyModule; use CGI qw(); sub new { my $class = shift; my %self; bless \%self => $class; $self{cgi} = CGI->new; return \%self; } sub go { my $self = shift; if ($self->{cgi}->request_method eq 'POST') { print $self->{cgi} ->header(-Status => 201, -Location => $self->{cgi}->url,); print $self->{cgi}->param('POSTDATA'); } elsif (length $self->{cgi}->path_info > 1) { print $self->{cgi} ->header(-Status => 500, -Content_type => 'text/plain',); print "error"; } else { print $self->{cgi} ->header(-Status => 200, -Content_type => 'application/xml',); print ""; } } 1;