--- FITS.pm.orig.2 2004-01-21 18:52:16.000000000 +0900 +++ FITS.pm 2004-01-21 21:25:13.000000000 +0900 @@ -568,7 +568,7 @@ , sub { my( $pdl, $row, $strptr ) = @_; # (ignore repeat and extra) my $n = $pdl->dim(0); - my $s = unpack( "B".$n, substr( $$strptr, 0, int(($n+7)/8))); + my $s = unpack( "B".$n, substr(${$strptr}, 0, int(($n+7)/8),'')); $s =~ tr/[01]/[\000\001]/; substr(${$pdl->get_dataref}, $n * $row, length($s)) = $s; } @@ -585,7 +585,7 @@ ,'A' => [ sub { # constructor # String - handle as perl list my($rowlen, $extra, $nrows, $szptr) = @_; my($i,@a); - if(ref $szptr eq 'SCALAR') {$$szptr += $rowlen;} + $$szptr += $rowlen; for $i(1..$nrows) { push(@a,' 'x$rowlen); } \@a; } @@ -698,7 +698,10 @@ . $hdr->{TTYPE$i} . ")\n"; } - + + # "A bit array consists of an integral number of bytes with trailing bits zero" + $tmpcol->{rpt} = PDL::ceil($tmpcol->{rpt}/8) if ($tmpcol->{type} eq 'X'); + $tmpcol->{handler} = # sic - assignment $PDL::IO::FITS_bintable_handlers->{ $tmpcol->{type} } or @@ -763,9 +766,9 @@ substr( $rawtable, 0, $rlen, ''); $tmpcol->{data}->upd_data; - } else { - barf("Bug detected: inconsistent types in BINTABLE reader\n"); - } + } else { + barf("Bug detected: inconsistent types in BINTABLE reader\n"); + } } if(length($rawtable) ne $prelen - $hdr->{NAXIS1}) { barf "Something got screwed up -- expected a length of $prelen - $hdr->{NAXIS1}, got ".length($rawtable).". Giving up.\n";