Pete Ratzlaff > Astro-FITS-CFITSIO-1.10 > examples/


Annotate this POD


New  3
Open  3
View/Report Bugs
Source   Latest Release: Astro-FITS-CFITSIO-1.11

match_datatype( ) ^

        $cfitsio_type = match_datatype($piddle);
        $cfitsio_type = match_datatype(long); # or short, or float, etc.

PDL datatypes are always guaranteed to be the same size on all architectures, whereas CFITSIO datatypes (TLONG, for example), will vary on some architectures since they correspond to the C datatypes on that system. This poses a problem for Perl scripts which wish to read FITS data into piddles, and do so in a portable manner. This routine takes a PDL object or PDL::Types token (returned by float() and friends when given no arguments), and returns the same-sized CFITSIO datatype, suitable for passing to routines such as fits_read_col().

syntax highlighting: