Browse Source

- removed 'use diagnostics'

- enhanced POD
master
Andreas Romeyke 2 months ago
parent
commit
01f25f0906
1 changed files with 18 additions and 2 deletions
  1. +18
    -2
      lib/File/FormatIdentification/Pronom.pm

+ 18
- 2
lib/File/FormatIdentification/Pronom.pm View File

@@ -3,7 +3,6 @@ package File::FormatIdentification::Pronom;
use feature qw(say);
use strict;
use warnings;
use diagnostics;
use XML::LibXML;
use Carp;
use List::Util qw( none first );
@@ -994,13 +993,30 @@ See example file F<bin/pronom2wxhexeditor.pl>. This colorizes the hex-blob to ch

There are better tools for the job, but as a proof of concept certainly not bad: Identifying the file type of a file.

See example file F<bin/pronomidentify.pl>
my $pronom = File::FormatIdentification::Pronom->new(
"droid_signature_filename" => $pronomfile
);
# .. $filestream is a scalar representing a file
foreach my $internalid ( $pronom->get_all_internal_ids() ) {
my $sig = $pronom->get_signature_id_by_internal_id($internalid);
my $puid = $pronom->get_puid_by_signature_id($sig);
my $name = $pronom->get_name_by_signature_id($sig);
my $quality = $pronom->get_qualities_by_internal_id($internalid);
my @regexes = $pronom->get_regular_expressions_by_internal_id($internalid);
if ( all {$filestream =~ m/$_/saa} @regexes ) {
say "$binaryfile identified as $name with PUID $puid (regex quality $quality)";
}
}

See example file F<bin/pronomidentify.pl> for a full working script.

=head3 Get PRONOM Statistics

To get a feeling for which signatures need to be revised in PRONOM, or why which file formats are difficult to recognize,
you can get detailed statistics for given signature files.

In the blog entry under L<https://kulturreste.blogspot.com/2018/10/heres-tool-make-it-work.html> the statistic report is presented in more detail.

=head2 EXPORT

None by default.


Loading…
Cancel
Save