Chart-Plotly
view release on metacpan or search on metacpan
lib/Chart/Plotly/Image/Orca/Client.pm view on Meta::CPAN
sub save_image {
my %params = @_;
my $plot = $params{plot};
my $file = path( $params{file} );
my $ua = LWP::UserAgent->new;
$ua->agent("Chart::Plotly::Image::Orca::Client/0.1");
my $req = HTTP::Request->new( POST => $params{server} );
$req->content_type('application/json');
$req->content( $plot->to_json_text );
my $res = $ua->request($req);
if ( $res->is_success ) {
path($file)->spew_raw( $res->content );
} else {
die "Can't export the plot. Server returned: " . $res->status_line;
}
return;
}
( run in 0.374 second using v1.01-cache-2.11-cpan-de7293f3b23 )