App-cpanel
view release on metacpan or search on metacpan
lib/App/cpanel.pm view on Meta::CPAN
sub api_request {
my ($method, $domain, $token, $parts, $args, @extra_args) = @_;
my ($url_token, $cookie_token) = split /\s+/, $token;
my $url = Mojo::URL->new("https://$domain:2083");
$url->path(join '/', '', "cpsess$url_token", @$parts);
$url->query(%$args) if $args;
CORE::state $ua = Mojo::UserAgent->new; # state as needs to live long enough to complete request
$ua->$method(
$url->to_abs . "",
{ Cookie => "cpsession=$cookie_token" },
@extra_args,
);
}
sub read_file {
my ($file) = @_;
die "$file: $!\n" unless -f $file;
die "$file: too readable\n" if (stat $file)[2] & 0044;
local $/;
open my $fh, $file or die "$file: $!\n";
( run in 0.379 second using v1.01-cache-2.11-cpan-e9199f4ba4c )