Rex-Endpoint-HTTP
view release on metacpan or search on metacpan
lib/Rex/Endpoint/HTTP.pm view on Meta::CPAN
$r->post("/fs/rename")->to("fs#rename");
$r->post("/fs/glob")->to("fs#glob");
$r->post("/fs/upload")->to("fs#upload");
$r->post("/fs/download")->to("fs#download");
$r->post("/fs/rmdir")->to("fs#rmdir");
$r->post("/fs/ln")->to("fs#ln");
$r->post("/fs/chown")->to("fs#chown");
$r->post("/fs/chgrp")->to("fs#chgrp");
$r->post("/fs/chmod")->to("fs#chmod");
$r->post("/fs/cp")->to("fs#cp");
$r->post("/file/open")->to("file#open");
$r->post("/file/close")->to("file#close");
$r->post("/file/read")->to("file#read");
# this seems odd, but "write" is not allowed as an action
lib/Rex/Endpoint/HTTP/Fs.pm view on Meta::CPAN
my $self = shift;
eval {
$self->_iface->rmdir($self->_path);
$self->render_json({ok => Mojo::JSON->true});
} or do {
$self->render_json({ok => Mojo::JSON->false});
};
}
sub chown {
my $self = shift;
my $ref = $self->req->json;
my $user = $ref->{user};
my $file = $self->_path;
my $options = $ref->{options};
eval {
$self->_iface->chown($user, $file, $options);
$self->render_json({ok => Mojo::JSON->true});
} or do {
$self->render_json({ok => Mojo::JSON->false});
};
}
sub chgrp {
my $self = shift;
my $ref = $self->req->json;
lib/Rex/Endpoint/HTTP/Interface/Fs/Base.pm view on Meta::CPAN
system("rm -rf " . $path);
if($? == 0) {
return 1;
}
die("Error deleting directory.");
}
sub chown {
my ($self, $user, $file, $options) = @_;
my $recursive = "";
if(exists $options->{"recursive"} && $options->{"recursive"} == 1) {
$recursive = " -R ";
}
system("chown $recursive $user $file");
if($? == 0) {
return 1;
}
die("Error changing ownership of file");
}
sub chgrp {
my ($self, $group, $file, $options) = @_;
lib/Rex/Endpoint/HTTP/Interface/Fs/Windows.pm view on Meta::CPAN
system("rd /Q /S " . $path);
if($? == 0) {
return 1;
}
die("Error deleting directory.");
}
sub chown {
my ($self, $user, $file, $options) = @_;
die("Not implemented on this platform.");
}
sub chgrp {
my ($self, $group, $file, $options) = @_;
die("Not implemented on this platform.");
}
sub chmod {
( run in 2.059 seconds using v1.01-cache-2.11-cpan-5511b514fd6 )