File::ArchivableFormats - Be able to select archivable formats
version 1.8
use File::ArchivableFormats; my $archive = File::ArchivableFormats->new(); open my $fh, '<', 'path/to/file'; my $result_fh = $archive->identify_from_fh($fh); my $result_path = $archive->identify_from_path('/path/to/file');
This module identifies filetypes and tells you whether they are considered archivable by various institutes. This is done via a plugin mechanism.
Parses the filename and returns the extension. Uses "fileparse" in File::Basename
Identify the file from a file handle. Please note that this does not work with a File::Temp filehandle.
Returns a data structure like this:
{ # DANS is the Prefered format list 'DANS' => { # Types tell you something about why something is on the # preferred format list 'types' => [ 'Plain text (Unicode)', 'Plain text (Non-Unicode)', 'Statistical data (data (.csv) + setup)', 'Raspter GIS (ASCII GRID)', 'Raspter GIS (ASCII GRID)' ], # The extensions by which belongs to the mime type/file 'allowed_extensions' => ['.asc', '.txt'], # Boolean which tells you if the file is archivable and # therfore preferred. 'archivable' => 1 }, 'mime_type' => 'text/plain' };
Identify the file from path/filename.
Identify based on the mimetype
Returns an array with all the installed plugins.
http://www.iana.org/assignments/media-types/media-types.xhtml
http://www.iana.org/assignments/media-types/application.csv
Wesley Schwengle <wesley@mintlab.nl>
This software is Copyright (c) 2017 by Mintlab BV.
This is free software, licensed under:
The European Union Public License (EUPL) v1.1
To install File::ArchivableFormats, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::ArchivableFormats
CPAN shell
perl -MCPAN -e shell install File::ArchivableFormats
For more information on module installation, please visit the detailed CPAN module installation guide.