use strict;
use warnings;
use Data::Dumper;
use LWP::UserAgent qw();
use HTTP::Request qw();
use JSON qw();
use Class::Load qw();
use Carp qw( carp croak );
use Data::Validate::Type qw();
our $API_
;
my $json_in = JSON::encode_json( $args{'data'} );
carp "Sending JSON request >" . ( defined( $json_in ) ? $json_in : '' ) . "<"
if $verbose;
$request->content_type('application/json');
$req
uest->content( $json_in );
carp "Request object: ", Dumper( $request )
if $verbose;
my $user_agent = LWP::UserAgent->new();
my $response = $user_agent->request($request);
if (! $response->is_
)
{
# You must use references to integers in order to have JSON.pm properly
# encode these as JSON boolean values. Without this, JSON will encode integer
# value as string...which is how I foun
tp://stackoverflow.com/questions/1087308/why-cant-i-properly-encode-a-boolean-from-postgresql-via-jsonxs-via-perl
$data->{'silenced'} = ( $args{'silenced'} == 0 ? \0: \1 );
}
my $response = $sel
)
{
# You must use references to integers in order to have JSON.pm properly
# encode these as JSON boolean values. Without this, JSON will encode integer
# value as string...which is how I foun