Subject: | Empty COMMENT cards read by CFITSIO cause warnings |
The CFITSIO fits_get_record routine removes blanks at the end of records.
When AFHI::parse_card process an empty COMMENT card, it gets the string 'COMMENT', which is only 7 chars long. It tries to substr($card,8), which causes perl to gripe about misuse of substr and uninitialized values.
The attached patch addresses this behavior
*** Astro-FITS-Header-2.8.1.old/Item/Item.pm Wed Jul 2 12:25:03 2003
--- Astro-FITS-Header-2.8.1.new/Item/Item.pm Wed Mar 2 15:04:16 2005
***************
*** 412,419 ****
# Store the type
$self->type( "COMMENT" );
! # We have comments
! $comment = substr($card,8);
$comment =~ s/\s+$//; # Trailing spaces
# Alasdair wanted to store this as a value
--- 412,424 ----
# Store the type
$self->type( "COMMENT" );
! # We have comments.
!
! # CFITSIO removes blank spaces at the end of cards, so blank
! # comment cards are reduced to just the word 'COMMENT' which
! # causes substr to throw a fit when asked for things after
! # the end of the string
! $comment = substr($card,8) if length($card) > 8;
$comment =~ s/\s+$//; # Trailing spaces
# Alasdair wanted to store this as a value