@@ -2,6 +2,22 @@ Revision history for Perl extension File::MimeInfo.
Versions up to 0.15 by Jaap Karssenberg <pardus@cpan.org>
Versions starting 0.16 by Michiel Beijen <michiel.beijen@gmail.com>
+0.26 2014-05-11
+ - Fix mimeinfo not adhering to the priorization of globs -
+ kudos Stefan Seifert.
+ - Fixed URL in POD. Only run POD 404 tests with extended testing.
+
+0.25 2014-04-03
+ - Included new test file in MANIFEST.
+
+0.24 2014-04-02
+ - Fixed freedesktop.org desktop-file-utils URL - David Steinbrunner.
+
+0.23 2014-04-02
+ - Fixed opening of files with '+' in mime type using
+ File::MimeInfo::Applications.
+ Debian bug 690334, brian m. carlson.
+
0.22 2014-02-27
- Fixed Double-close on a filehandle issue
(RT 93221) - Christian Ludwig.
@@ -11,7 +11,7 @@ META.json
META.yml
mimeopen
mimetype
-README
+README.md
t/00_use_ok.t
t/01_normal.t
t/02_magic.t
@@ -21,18 +21,22 @@ t/05_more.t
t/06_pod_ok.t
t/07_pod_cover.t
t/08_changes.t
+t/09_no404s.t
t/applications/foo.desktop
t/applications/mimeinfo.cache
+t/applications/mirage.desktop
t/default/binary_file
t/default/empty_file
t/default/encoding_breakage
t/default/plain_text
t/default/utf8_text
t/magic/application_msword
+t/magic/application_octet-stream
t/magic/application_vnd.corel-draw
t/magic/application_x-executable
t/magic/application_x-perl
t/magic/application_x-perl.txt
+t/magic/text_plain
t/magic/text_x-patch
t/mime/aliases
t/mime/globs
@@ -4,7 +4,7 @@
"Jaap Karssenberg <pardus@cpan.org>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.132830",
+ "generated_by" : "ExtUtils::MakeMaker version 6.8, CPAN::Meta::Converter version 2.132830",
"license" : [
"perl_5"
],
@@ -50,5 +50,5 @@
"url" : "https://github.com/mbeijen/File-MimeInfo"
}
},
- "version" : "0.22"
+ "version" : "0.26"
}
@@ -12,7 +12,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: 6.30
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.132830'
+generated_by: 'ExtUtils::MakeMaker version 6.8, CPAN::Meta::Converter version 2.132830'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -27,4 +27,4 @@ requires:
resources:
bugtracker: https://github.com/mbeijen/File-MimeInfo/issues
repository: https://github.com/mbeijen/File-MimeInfo
-version: 0.22
+version: 0.26
@@ -1,44 +0,0 @@
-File-MimeInfo
-=============
-
-This module can be used to determine the mime type of a file; it's a
-replacement for File::MMagic trying to implement the freedesktop
-specification for using the shared mime-info database. The package
-comes with a script called 'mimetype' that can be used as a file(1)
-work-alike.
-
-INSTALLATION
-
-To install this module type the following:
-
- perl Makefile.PL
- make
- make test
- make install
-
-DEPENDENCIES
-
-This module expects the freedesktop mime database to be installed,
-some linux distrobutions include it, otherwise it can obtained
-from :
-
- http://freedesktop.org/Software/shared-mime-info
-
-This module requires these other modules which can be obtained from
-the CPAN <http://cpan.org> if they are not allready installed on
-your system :
-
- Carp
- Exporter
- Fcntl
- Pod::Usage
- File::Basename
- File::BaseDir
- File::DesktopEntry
-
-COPYRIGHT AND LICENCE
-
-Copyright (c) 2003,2008 Jaap G Karssenberg. All rights reserved.
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
-
@@ -0,0 +1,42 @@
+# File-MimeInfo
+
+This module can be used to determine the mime type of a file; it's a
+replacement for [File::MMagic](https://metacpan.org/pod/File::MMagic)
+trying to implement the freedesktop specification for using the shared
+mime-info database. The package comes with a script called `mimetype`
+that can be used as a `file(1)` work-alike.
+
+## INSTALLATION
+
+To install this module type the following:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+## DEPENDENCIES
+
+This module expects the freedesktop mime database to be installed,
+some linux distributions include it, otherwise it can obtained
+from:
+
+ http://freedesktop.org/Software/shared-mime-info
+
+This module requires these other modules which can be obtained from
+the [CPAN](https://metacpan.org) if they are not allready installed on
+your system:
+
+* Carp
+* Exporter
+* Fcntl
+* Pod::Usage
+* File::Basename
+* File::BaseDir
+* File::DesktopEntry
+
+## COPYRIGHT AND LICENCE
+
+Copyright (c) 2003, 2008 Jaap G Karssenberg. All rights reserved.
+This program is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
@@ -8,7 +8,7 @@ use File::MimeInfo qw/mimetype_canon mimetype_isa/;
use File::DesktopEntry;
require Exporter;
-our $VERSION = '0.22';
+our $VERSION = '0.26';
our @ISA = qw(Exporter);
our @EXPORT = qw(
@@ -21,7 +21,7 @@ WARNING: You don't seem to have any mimeinfo.cache files.
Try running the update-desktop-database command. If you
don't have this command you should install the
desktop-file-utils package. This package is available from
-http://freedesktop.org/wiki/Software_2fdesktop_2dfile_2dutils
+http://freedesktop.org/wiki/Software/desktop-file-utils/
EOT
sub mime_applications {
@@ -120,7 +120,7 @@ sub _read_list { # read list with "mime/type=foo.desktop;bar.desktop" format
my @list;
open LIST, '<', $file or croak "Could not read file: $file";
while (<LIST>) {
- /^$mimetype=(.*)$/ or next;
+ /^\Q$mimetype\E=(.*)$/ or next;
push @list, grep defined($_), split ';', $1;
}
close LIST;
@@ -135,7 +135,7 @@ sub _write_list {
if (-f $file) {
open LIST, '<', $file or croak "Could not read file: $file";
while (<LIST>) {
- $text .= $_ unless /^$mimetype=/;
+ $text .= $_ unless /^\Q$mimetype\E=/;
}
close LIST;
$text =~ s/[\n\r]?$/\n/; # just to be sure
@@ -294,6 +294,6 @@ L<File::MimeInfo>,
L<File::MimeInfo::Magic>,
L<File::BaseDir>
-L<http://freedesktop.org/wiki/Software_2fdesktop_2dfile_2dutils>
+L<http://freedesktop.org/wiki/Software/desktop-file-utils/>
=cut
@@ -17,7 +17,7 @@ BEGIN {
our @ISA = qw(Exporter File::MimeInfo);
our @EXPORT = qw(mimetype);
our @EXPORT_OK = qw(extensions describe globs inodetype magic);
-our $VERSION = '0.22';
+our $VERSION = '0.26';
our $DEBUG;
our $_hashed = 0;
@@ -10,7 +10,7 @@ our @ISA = qw(Exporter);
our @EXPORT = qw(mime_exec mime_system);
our @EXPORT_OK = qw(suggest_script_name);
our %EXPORT_TAGS = (magic => \@EXPORT);
-our $VERSION = '0.22';
+our $VERSION = '0.26';
our @choicespath = (
config_home('rox.sourceforge.net'),
File::Spec->catdir($ENV{HOME}, 'Choices'),
@@ -174,6 +174,6 @@ modify it under the same terms as Perl itself.
L<File::MimeInfo>,
L<File::MimeInfo::Magic>,
-L<http://rox.sourceforce.net>
+L<http://rox.sourceforge.net>
=cut
@@ -10,7 +10,7 @@ require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(mimetype);
our @EXPORT_OK = qw(extensions describe globs inodetype mimetype_canon mimetype_isa);
-our $VERSION = '0.22';
+our $VERSION = '0.26';
our $DEBUG;
our ($_hashed, $_hashed_aliases, $_hashed_subclasses);
@@ -163,7 +163,7 @@ sub _hash_globs {
($string, $glob) = split /:/, $_, 2;
unless ($glob =~ /[\?\*\[]/) { $literal{$glob} = $string }
elsif ($glob =~ /^\*\.(\w+(\.\w+)*)$/) {
- $extension{$1} = $string;
+ $extension{$1} = $string unless exists $extension{$1};
$mime2ext{$string} = [] if !defined($mime2ext{$string});
push @{$mime2ext{$string}}, $1;
} else { unshift @globs, [$glob, _glob_to_regexp($glob), $string] }
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
-our $VERSION = '0.22';
+our $VERSION = '0.26';
$|++;
# ########## #
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
-our $VERSION = '0.22';
+our $VERSION = '0.26';
$|++;
# ########## #
@@ -1,7 +1,7 @@
use strict;
-use Test::More tests => 30;
+use Test::More tests => 31;
$ENV{XDG_DATA_HOME} = './t/';
$ENV{XDG_DATA_DIRS} = './t/'; # forceing non default value
@@ -85,3 +85,4 @@ ok( describe('text/plain') eq 'Plain Text', 'describe works' ); # 29
}
ok( describe('text/plain') eq 'Platte tekst', 'describe works with other languages' ); # 30
+is( mimetype('t/test.png'), 'image/png', 'glob priority observed'); # 31
@@ -1,5 +1,6 @@
use strict;
-use Test::More tests => 14;
+use File::Spec;
+use Test::More tests => 16;
$ENV{XDG_DATA_HOME} = './t/';
$ENV{XDG_DATA_DIRS} = './t/'; # forceing non default value
@@ -14,7 +15,7 @@ is_deeply( [extensions('text/plain')], [qw#asc txt#], 'wantarray extensions work
{
# call above should have triggered rehash()
no warnings; # don't bug me because I use these vars only once
- ok(scalar(keys %File::MimeInfo::extension) == 6, 'extension data is there'); # 4
+ is(scalar(keys %File::MimeInfo::extension), 7, 'extension data is there'); # 4
}
## test alias lookup
@@ -36,13 +37,26 @@ SKIP: {
use_ok('File::MimeInfo::Applications');
- my ($default, @other) = mime_applications('text/plain');
+
+ my %list = (
+ 'text/plain' => 'foo.desktop',
+ 'image/svg+xml' => 'mirage.desktop',
+ );
+
+ for my $type (keys %list) {
+
+ my ($default, @other) = mime_applications($type);
ok (
!defined($default) &&
(@other == 1) &&
ref($other[0]) eq 'File::DesktopEntry',
'mime_application() works'
);
- ok ( $other[0]->{file} =~ /foo\.desktop$/, "desktop file is the right one" );
+ is (
+ $other[0]->{file},
+ File::Spec->catfile('t', 'applications', $list{$type}),
+ "desktop file is the right one",
+ );
+ }
}
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+use strict; use warnings;
+
+use Test::More;
+
+plan skip_all => "Skip \$ENV{EXTENDED_TESTING} is not set\n";
+eval "use Test::Pod::No404s";
+if ( $@ ) {
+ plan skip_all => 'Test::Pod::No404s required for testing POD';
+} else {
+ all_pod_files_ok();
+}
@@ -1,2 +1,3 @@
[MIME Cache]
text/plain=foo.desktop
+image/svg+xml=mirage.desktop
@@ -0,0 +1,26 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Encoding=UTF-8
+Name=Foo Viewer
+Comment=The best viewer for Foo objects available!
+Comment[eo]=Tekstredaktilo
+Comment[ja]=テキストエディタ
+TryExec=fooview
+Exec=fooview %F
+Icon=fooview.png
+MimeType=image/x-foo
+X-KDE-Library=libfooview
+X-KDE-FactoryName=fooviewfactory
+X-KDE-ServiceType=FooService
+
+[Desktop Action Inverse]
+# Inverse Foo => ooF
+Exec=fooview --inverse %f
+Name=Foo Viewer (inverse image)
+
+[Desktop Action Edit]
+Exec=fooview --edit %f
+Name=Foo Viewer (edit image)
+Icon=fooview-edit.png
+
diff --git a/var/tmp/source/MICHIELB/File-MimeInfo-0.26/File-MimeInfo-0.26/t/magic/application_octet-stream b/var/tmp/source/MICHIELB/File-MimeInfo-0.26/File-MimeInfo-0.26/t/magic/application_octet-stream
new file mode 100644
index 00000000..ec227ada
Binary files /dev/null and b/var/tmp/source/MICHIELB/File-MimeInfo-0.26/File-MimeInfo-0.26/t/magic/application_octet-stream differ
@@ -0,0 +1 @@
+This is plain text
@@ -7,3 +7,5 @@ text/x-makefile:[Mm]akefile
text/plain:*.asc
text/plain:*.txt
text/x-patch:*.patch
+image/png:*.png
+image/apple-ios-png:*.png