I just tried the following:
#!/usr/bin/perl
use strict;
use warnings;
use feature qw(say);
use SVG ();
my $svg = SVG->new( viewBox => "0 0 100 100", width => '100', height => '100');
$svg->circle( cx => '50', cy => '50', r => '20', id => 'my_circle');
my $text = $svg->xmlify;
say $text;
And the following was returned:
Can't locate object method "circle" via package "SVG" at /home/me/scripts/svg_test.pl line 10.
It appears that circle is not autoloaded
Then I tried...
my $svg = SVG->new( viewBox => "0 0 100 100", width => '100', height => '100');
$svg->title( id => 'my_title')->cdata('This is my title');
The following was returned:
Can't locate object method "title" via package "SVG" at /home/me/scripts/svg_test.pl line 10.
Also, the <path> element does not have x, y, or points. It has the d= attribute that looks like the following:
<path d="m 20,20 h 60 v 20 i 10,10" class="path" id="my_path" />
So, I can see how the SVG module's get_path/path can apply to <line> and <polyline>, but not to the actual <path> element.
LA
On Sat Mar 07 07:09:27 2020, MANWAR wrote:
Show quoted text> Hi,
>
> Thanks for your interest SVG distribution.
>
> The three methods you mentioned in your ticket i.e. circle, path and
> title are AUTOLOADED into SVG namespace through SVG::Element.
>
> If you look at the pod document for SVG, you will find plenty of
> examples.
> Please find below example from the pod showing the above methods.
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use SVG;
>
> # create an SVG object
> my $svg= SVG->new( width => 200, height => 200);
>
> # use explicit element constructor to generate a group element
> my $y = $svg->group(
> id => 'group_y',
> style => {
> stroke => 'red',
> fill => 'green'
> },
> );
>
> # add a circle to the group
> $y->circle( cx => 100, cy => 100, r => 50, id => 'circle_in_group_y'
> );
>
>
> # a 10-pointsaw-tooth pattern drawn with a path definition
> my $xv = [0,1,2,3,4,5,6,7,8,9];
> my $yv = [0,1,0,1,0,1,0,1,0,1];
>
> $points = $svg->get_path(
> x => $xv,
> y => $yv,
> -type => 'path',
> -closed => 'true' #specify that the polyline is closed
> );
>
> $tag = $svg->path(
> %$points,
> id => 'pline_1',
> style => {
> 'fill-opacity' => 0,
> 'fill' => 'green',
> 'stroke' => 'rgb(250,123,23)'
> }
> );
>
> my $tag = $svg->title(id=>'document-title')->cdata('This is the
> title');