AC-MrGamoo
view release on metacpan or search on metacpan
lib/AC/MrGamoo/API/Get.pm view on Meta::CPAN
use strict;
sub handler {
my $class = shift;
my $io = shift;
my $proto = shift;
my $req = shift;
my $content = shift;
return unless $proto->{want_reply};
in_background( \&_get_file, $io, $proto, $req, $content );
}
sub _get_file {
my $io = shift;
my $proto = shift;
my $req = shift;
my $content = shift;
my $file = filename($req->{filename});
my $fd = $io->{fd};
lib/AC/MrGamoo/API/Put.pm view on Meta::CPAN
my $io = shift;
my $proto = shift;
my $req = shift;
my $content = shift;
if( conf_value('scriblr') =~ /no|off/i ){
reply( 500, 'Error', $io, $proto, $req );
return;
}
in_background( \&_put_file, $io, $proto, $req, $content );
}
sub _put_file {
my $io = shift;
my $proto = shift;
my $req = shift;
my $content = shift;
my $file = filename($req->{filename});
my $fd = $io->{fd};
lib/AC/MrGamoo/API/Simple.pm view on Meta::CPAN
package AC::MrGamoo::API::Simple;
use AC::MrGamoo::Protocol;
use AC::MrGamoo::Debug 'api';
use AC::Import;
use POSIX;
require 'AC/protobuf/std_reply.pl';
use strict;
our @EXPORT = qw(reply on_success on_failure in_background nbfd_reply);
sub reply {
my $code = shift;
my $msg = shift;
my $io = shift;
my $proto = shift;
my $req = shift;
unless( $proto->{want_reply} ){
$io->shut();
lib/AC/MrGamoo/API/Simple.pm view on Meta::CPAN
my $x = shift;
my $e = shift;
my $io = shift;
my $proto = shift;
my $req = shift;
reply( 500, 'Error', $io, $proto, $req );
}
sub in_background {
my $func = shift;
my $io = shift;
my $proto = shift;
my $req = shift;
my $pid = fork();
if( !defined($pid) ){
problem("cannot fork: $!");
reply( 500, 'Error', $io, $proto, $req );
( run in 0.680 second using v1.01-cache-2.11-cpan-0b5f733616e )