$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().
To install Astro::FITS::CFITSIO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Astro::FITS::CFITSIO
CPAN shell
perl -MCPAN -e shell install Astro::FITS::CFITSIO
For more information on module installation, please visit the detailed CPAN module installation guide.