RE: [docbook-apps] Areaoverlay problem

From
Mauritz Jeanson <>
Date
2011-06-13T20:07:05+00:00
ID
581384FA0B7A4A90811076E61D2D9A9F@D7MZ171J
Thread
RE: [docbook-apps] Areaoverlay problem
|  -----Original Message-----
|  From: Kirill Churin 
|  
|  Hello! i'm trying to use areasearch/areaoverlay suite from
|  docbook-trunk/imagecon.
|  
|  Areasearch works fine and provides <areas>, but when I run 
|  areaoverlay on my XML it says: "Can't parse callout data".


This is a little strange. With Perl 5.10, the areaoverlay script works for
me. But with Perl 5.12, I get that same error message. The problem is in
this snippet from the makeOverlay subroutine:

 while (@coords) {
	while (split(/\s+/, shift @coords)) {
	    my $conumber = shift || die "Can't parse callout data.\n";
	    my $llcorner = shift || die "Can't parse callout data.\n";
	    my $urcorner = shift || die "Can't parse callout data.\n";

I was able to make it work by changing the above to 

 while (@coords) {
      my @tmp = (split(/\s+/, shift @coords));
      while (@tmp) {
          my $conumber = shift @tmp || die "Can't parse callout data.\n";
	    my $llcorner = shift @tmp || die "Can't parse callout data.\n";
	    my $urcorner = shift @tmp || die "Can't parse callout data.\n";

The 5.12 behaviour makes sense IMHO (see
http://perldoc.perl.org/functions/shift.html). Without an ARRAY argument,
the shift function returns the first element of @_, which is the wrong
array.

Mauritz