diff options
Diffstat (limited to 'src/MTools')
-rw-r--r-- | src/MTools/SVG/SVGLoader.pm | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/MTools/SVG/SVGLoader.pm b/src/MTools/SVG/SVGLoader.pm index 1aeafc7..5075beb 100644 --- a/src/MTools/SVG/SVGLoader.pm +++ b/src/MTools/SVG/SVGLoader.pm @@ -30,6 +30,9 @@ sub load { my $svgfile = $path; my $tag; my $ftag; + + my $autogenPath = defined $pathForAutogen ? $pathForAutogen : 'AUTOGEN::'; + if (index($svgfile, '#') == -1) { $tag = ''; @@ -41,7 +44,7 @@ sub load { $tag = substr ($path, index ($path, '#') + 1, length ($path)); $ftag = "::$tag"; } - + if($svgfile =~ /(.*)\.svg/) { my $filename = $1; @@ -52,13 +55,15 @@ sub load { } my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($svgfile); my ($dev2,$ino2,$mode2,$nlink2,$uid2,$gid2,$rdev2,$size2,$atime2,$mtime2,$ctime2,$blksize2,$blocks2) = (0,0,0,0,0,0,0,0,0,0,0,0,0); - my $filepath = 'AUTOGEN::'.$filename; + + my $filepath = $autogenPath.$filename; + $filepath = "$filepath$ftag.pm"; $filepath =~ s/::/\//g; $filename =~ s/\//::/g; if(-e $filepath) { - ($dev2,$ino2,$mode2,$nlink2,$uid2,$gid2,$rdev2,$size2,$atime2,$mtime2,$ctime2,$blksize2,$blocks2) = stat($filepath); + ($dev2,$ino2,$mode2,$nlink2,$uid2,$gid2,$rdev2,$size2,$atime2,$mtime2,$ctime2,$blksize2,$blocks2) = stat($filepath); } if( $mtime2 < $mtime ) { @@ -67,7 +72,7 @@ sub load { SVG::SVG2zinc::parsefile( $svgfile, "PerlClass", - -out => "AUTOGEN::$filename$ftag.pm", + -out => "$autogenPath$filename$ftag.pm", -verbose => 0, -render => 1, -namespace => 0, @@ -75,7 +80,8 @@ sub load { ); } require "$filepath"; - my $packagename = "AUTOGEN::$filename$ftag"; + my $packagename = "$autogenPath$filename$ftag"; + return new $packagename ( -zinc => $zinc, -topgroup => $topgroup, |