mbeijen / File-MimeInfo

Perl module for determining file types using the freedesktop.org shared mime-info database
https://metacpan.org/module/File::MimeInfo
20 stars 13 forks source link

suggestion for behaviour of `mimetype_isa` #30

Open doriantaylor opened 6 years ago

doriantaylor commented 6 years ago

Hello,

I found myself writing the same mimetype_really_isa function over and over again, such that I eventually made it into a module of its own (a Role, actually):

https://github.com/doriantaylor/p5-role-mimeinfo/blob/master/lib/Role/MimeInfo.pm#L80

The code changes the behaviour of mimetype_isa the following ways:

The purpose was to create a mimetype_isa that would take as wide a range of input as possible and didn't need any finessing first, which I found myself repeatedly doing with my own ad-hoc mimetype_really_isa function.

So, I wrapped it up into a Role. It really shouldn't be a Role. Indeed the code should probably be in this module.

But, of course, the behaviour is subtly different, so I'm not about to do a fork/clone/PR without talking to you first.

Thoughts?