Skip Menu |

This queue is for tickets about the SVG CPAN distribution.

Report information
The Basics
Id: 116523
Status: new
Priority: 0/
Queue: SVG

People
Owner: Nobody in particular
Requestors: ervin.peters [...] ervnet.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: SVG::Element: empty $self->{-docref} after Copying Elements from svg1 to svg2
Date: Wed, 27 Jul 2016 14:08:07 +0200
To: bug-SVG [...] rt.cpan.org
From: Ervin Peters <ervin.peters [...] ervnet.de>
Following situation I create a SVG. I'd like to use symbols from Another SVG, therefore I create a subroutine which opens a SVG symbol library temporarily via SVG::Parser. The copying works like $symnode = $symbollibsvg->getElementByID($id); .... $insertnode = ( $mastersvg}->getElements("defs") )[0]; $insertnode->insertAfter($symnode); the subroutine ends and the Symbollibsvg ist destroyed. At the end I do $mastersvg->xmlify() and get a bunch of error messages which relates to an empty $self->{-docref} in many elements. Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/vendor_perl/5.20.2/SVG/Element.pm line 176 Use of uninitialized value in repeat (x) at /usr/lib/perl5/vendor_perl/5.20.2/SVG/Element.pm line 177 I created a subroutine: ----------------------------8<--------------------- my $ind = ' '; sub check_docrefs($$$$) { my ( $self, $item, $level, $dr ) = @_; my $result = ''; $dr = $item->{-docref} unless defined($dr); $level = 0 unless defined($level); if ( !defined( $item->{-docref} ) ) { $result = ( $ind x $level ) . $item->{-name} . " : " . " should be defined to $dr, corrected<br />\n"; $item->{-docref} = $dr; } elsif ($dr != $item->{-docref} ) { $result = ( $ind x $level ) . $item->{-name} . " : " . $item->{-docref} . " should be $dr corrected<br />\n"; $item->{-docref} = $dr; } foreach my $c ( @{ $item->{-childs} } ) { $result .= $self->check_docrefs( $c, ++$level, $dr ); } return $result; } ----------------------------8<--------------------- and run it before xmlify. I got a lot of Elements to be corrected. After that correction, there were no errors anymore and the svg was formated as expected. Thinking about I found: The error sems to me that SVG::Element uses Refs to the containing document which aren't changed to the document ref of the new containing Element. Kind regards Ervin -- Ervin Peters Herderplatz 12 D 99423 Weimar Mobile: +49 172 2043926 Tel: +49 3643 805745