You're using POE very incorrectly. Based on the reading of your server, here's one that should do what you want. It's not tested at all, however. People in irc.perl.org #poe may be able to help you further.
#!/usr/bin/perl
#use strict;
# use both POE server and the filter needed
use POE qw(Component::Server::TCP Filter::Stream);
my $Dest = Value("DestinationXMLLocation");
my $Src = Value("SourceXMLLocation");
POE::Component::Server::TCP->new(
Alias => "sum_server",
Port => 11211,
ClientFilter => "POE::Filter::Stream",
ClientInput => sub {
my ($storage, $client_input) = @_[HEAP, ARG0];
$storage->{buf} .= $client_input;
# Shift the next request off the buffer.
my ($req_type, $next_request, $new_buf) = parse_client_input(
$storage->{buf}
);
# No request yet. Wait for more input.
return unless defined $next_request;
# Replace the buffer with what's left.
$storage->{buf} = $new_buf;
if ($req_type eq "interface_levels_available") {
open(FH, "<", "$Src\\interfaceLevelsAvailableResponse-OK.xml") o
+r die $!;
}
elsif ($req_type eq "interface_level_request") {
open(FH, "<", "$Src\\interfaceLevelResponse-OK.xml") or die $!;
}
else {
warn "ignoring illegal request: $next_request\n";
return;
}
# Send the contents of the opened file.
my $output = join("", <FH>);
close(FH);
$storage->{client}->put($output);
},
);
sub parse_client_input {
my $input_buffer = shift;
# Up to you to define.
# Removes one request from the beginning of $input_buffer.
# Returns nothing if $input_buffer doesn't contain a complete reques
+t.
# Returns the new request type, the request itself, and the remains
# of $input_buffer on success.
#
# If your protocol is line-based, use POE::Filter::Line above
# instead of POE::Filter::Stream, and then don't worry about buffer
# management.
my $request_type = "interface_levels_available";
return($request_type, $input_buffer, "");
}