Raw
NAME
File::Metadata::Libextractor::Raw - A simple interface to libextractor
SYNOPSIS
use v6;
use File::Metadata::Libextractor::Raw;
use File::Metadata::Libextractor::Constants;
use NativeCall;
#| This program extracts the information about a file
sub MAIN($file! where { .IO.f // die "file '$file' not found" })
{
my $plugins = EXTRACTOR_plugin_add_defaults(EXTRACTOR_OPTION_DEFAULT_POLICY);
EXTRACTOR_extract(
$plugins,
$file,
Pointer[void],
0,
# callback function that handles the metadata (begin)
-> $, *@args {
(«'Plugin name' 'Plugin type' 'Plugin format' 'Mime type' 'Data type' 'Data length'»
»~» ': '
»~» @args)».say;
0;
},
# callback function that handles the metadata (end)
Pointer[void]);
EXTRACTOR_plugin_remove_all($plugins);
}
DESCRIPTION
For more details on libextractor see https://www.gnu.org/software/libextractor/manual/libextractor.html.
Prerequisites
This module requires the libextractor library to be installed. Please follow the instructions below based on your platform:
Debian Linux
sudo apt-get install libextractor3
The module looks for a library called libextractor.so.3 .
Installation
To install it using zef (a module management tool):
$ zef install File::Metadata::Libextractor
Testing
To run the tests:
$ prove -e "raku -Ilib"
Author
Fernando Santagata
License
The Artistic License 2.0