File: svg.psgi

package info (click to toggle)
libsvg-perl 2.87-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 464 kB
  • sloc: perl: 2,789; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 454 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl
use strict;
use warnings;

# run this example using plackup -r examples/svg.psgi

use SVG;
 
my $app = sub {
	my $svg = SVG->new(
		width  => 200,
		height => 200,
	);
	$svg->title()->cdata('I am a title');

	# add a circle
	$svg->circle(
		cx => 100,
		cy => 100,
		r  => 50,
		id => 'circle_in_group_y',
		style => {
			fill => '#FF0000',
		}
	);

	return [
		'200',
		[ 'Content-Type' => 'image/svg+xml' ],
		[ $svg->xmlify ],
	];
};