File: save.pl

package info (click to toggle)
libgd-graph-perl 1.54~ds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 800 kB
  • sloc: perl: 5,097; makefile: 52; sh: 7
file content (15 lines) | stat: -rw-r--r-- 288 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sub save_chart
{
	my $chart = shift or die "Need a chart!";
	my $name = shift or die "Need a name!";

	my $ext = $chart->export_format;

	open(my $out, '>', "$name.$ext") or
		die "Cannot open '$name.$ext' for write: $!";
	binmode $out;
	print $out $chart->gd->$ext();
	close $out;
}

1;