N = "1.0.0";
use LWP::UserAgent qw//;
use JSON qw//;
use HTTP::Request qw//;
sub from_json {
JSON->new->utf8->decode(@_);
}
sub to_json {
JSON->new->utf8->encode(@_);
}
sub new {
my (
$url))
or die "unable to create GET $url request: $!\n";
$req->header('Accept' => 'application/json');
$req->header('X-Vault-Token', '[REDACTED]')
if $self->{_token};
if ($self->{_debug}) {
p
-----------------\n";
print STDERR $res->as_string;
print STDERR "\n\n";
}
my $body = from_json($res->decoded_content);
if (!$res->is_success) {
$self->{_error} = $body;
return undef;
}