if ( $arg is a FILEHANDLE ) { use DBI::Pretty::File; %hash = read_stuff_from_file( $arg ); } elsif ( $arg is a XML datastream ) { use DBI::Pretty::XML; ... } etc.