Subject: | RPC::XML::Server dies on sending large data |
RPC::XML::Server dies on sending large data with the following message:
-------------------------------------------
Can't locate object method "new" via package "File::Temp" at
blib/lib/RPC/XML/Server.pm (autosplit into
blib/lib/auto/RPC/XML/Server/process_request.al) line 1915.
-------------------------------------------
I cannot send binary files larger than ~790000 bytes (binary data is
sent base64 encoded).
I tried to send plain text files too (to avoid base64 encoding).
RPC::XML::Server dies on files larger than ~1050000 bytes.
How to reproduce:
1. Create Perl script (our server):
==================== CODE ==============================
#! /usr/bin/perl
use strict;
use warnings;
use RPC::XML::Server;
my $srv = RPC::XML::Server->new(port => 9002);
$srv->add_method({
name => 'test',
signature => [ 'string' ],
code => \&mysub
});
$srv->server_loop();
exit;
sub mysub {
my ($server) = @_;
my $in_file = "./test.bin";
open my $IN, '<', $in_file
or die "$0 : failed to open input file $in_file : $!\n";
binmode $IN;
local $/ = '';
my $context = '';
my $buf;
while ( read($IN, $buf, 8 * 2**10) ) {
$context .= $buf;
}
close $IN
or warn "$0 : failed to close input file $in_file : $!\n";
my $bindata = new RPC::XML::base64($context);
return $bindata;
}
==================== END CODE ===========================
2. Place a large file named "test.bin" in the script's directory.
3. Run this script to be a server.
3. Send XML request to this server.
RPC::XML::Server will die.
Tested with Perl 5.10.1 and RPC::XML::Server version 0.72 and 0.74.