-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WL: Merge in mimetype_isa
from Role::MimeInfo?
#33
Comments
In my opinion a third parameter to Can you give a few examples of actual parameters and their result to this function? We then could also use those for the documentation. |
The proposal is to change the behaviour of # recursion
mimetype_isa('application/xhtml+xml', 'text/plain'); # false
mimetype_isa('application/xhtml+xml', 'text/plain', 1); # true
# aliases
mimetype_isa('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/x-zip-compressed'); # false
mimetype_isa('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/x-zip-compressed', 1); # true This is the default behaviour of the wrapper I wrote in Role::MimeInfo. I wrote that thing because I found myself writing the same routines over and over with File::MimeInfo to normalize content types (e.g. from the wild) and compare them recursively. One use case in particular is testing a claimed MIME type (e.g. from a It makes sense that this functionality be universal and not just in a Moo(se) role, but of course there are probably systems that depend on the current behaviour of |
Hello,
Some time ago I wrote a Moo(se) Role that added some recursive behaviour to
mimetype_isa
. This was a very quick-and-dirty solution at the time, in order to obviate cutting and pasting the same couple dozen lines of code. Of course, not everything is suitable to be written in Moo(se).As such I am wondering if you're interested in accepting a patch. I decided on this overture rather than going and diving straight into a pull request because I want some input beforehand:
The behaviour of my
mimetype_isa
is such that it returns true if the$type
and$parent
are the same, and will likewise return true if either$type
or$parent
is an alias or deprecated type identifier, as well as if$parent
is not an immediate ancestor of$type
. These cases (since last I checked) all return false inFile::MimeInfo
.Anyway, since this behaviour is significantly different, I'm wondering if it would make sense to patch in a
mimetype_isa_deep
or add a flag tomimetype_isa
to switch on this behaviour.That is—of course—if you're interested in the offer.
The text was updated successfully, but these errors were encountered: