File::M...nfo::Rox(3)
β¨ File::MimeInfo::Rox π
okay bestie, so this is a Perl module called File::MimeInfo::Rox β and the whole vibe is that it opens files by mimetype, Rox style π. Like, the rox file browser way of doing things, but in Perl. slay.
We're in the File::M...nfo::Rox(3) manpage, user contributed Perl docs, and honestly? it's giving "small module, big personality" π
πΈ NAME πΈ
File::MimeInfo::Rox β open files by mimetype, "Rox style" β¨
π¦ SYNOPSIS π¦
like, here's the whole thing, literally verbatim:
use File::MimeInfo::Magic;
use File::MimeInfo::Rox qw/:magic/;
# open some file with the appropriate program
mime_system($somefile);
# more verbose version
my $mt = mimetype($somefile)
|| die "Could not find mimetype for $somefile\n";
mime_system($somefile, $mt)
|| die "No program to open $somefile available\n";
first one's the quick girlie version, second one's the "I want to know what actually happened" version πββοΈ
π DESCRIPTION π
so this module tries to mimic the behaviour of the rox file browser <http://rox.sf.net> when it "opens" data files. no cap, that's the whole assignment π«Ά
how it does it: it determines the mime type, then searches in rox's "Choices" directories for a program that can handle that mimetype. that's it. that's the mechanism β¨
and if you want the extensive discussion of this mechanism? the original text says: see the rox documentation. she read the docs so you don't have to π
π EXPORT π
the methods mime_exec and mime_system are exported π
and if you use the export tag :magic, you get the same methods but File::MimeInfo::Magic will be used for mimetype lookup. same energy, different engine β
π ENVIRONMENT π
the environment variable CHOICESPATH is used when searching for rox's config dirs ποΈ
it defaults to:
"$ENV{HOME}/Choices:/usr/local/share/Choices:/usr/share/Choices"
three paths, colon-separated, home first. iykyk π§
π METHODS π
mime_system($file) / mime_system($file, $mimetype, @_)
try to open $file with the appropriate program for files of its mimetype π₯°
you can use $mimetype to force the mimetype β and fr fr, if you already know the mimetype it saves a lot of time to just tell it. main character efficiency π
now the important caveats, bestie, pay attention:
- if either the mimetype couldn't be determined or no appropriate program could be found,
undefis returned π - if the actual system fails, an exception is raised π
all remaining arguments are passed on to the handler π«Ά
mime_exec($file) / mime_exec($file, $mimetype, @_)
like mime_system() but uses exec instead of system, so it never returns if successful π
like, she's gone. she left the building. that's the whole point β¨
suggest_script_name($mimetype)
returns the list ($dir, $file) for the suggested place to write new script files (or symlinks) for mimetype $mimetype π
and ngl, the suggested dir doesn't need to exist. it's a suggestion, not a promise π
πΈ AUTHOR πΈ
Jaap Karssenberg <pardus@cpan.org> β maintained by Michiel Beijen <mb@x14.nl> π«Ά
π¦ COPYRIGHT π¦
Copyright (c) 2003, 2012 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 β¨
β SEE ALSO β
File::MimeInfoFile::MimeInfo::Magic- <http://rox.sourceforce.net>
(yes, that URL is spelled sourceforce.net in the original β copying it exactly, bestie, not my job to fix it π)
heads up: the original page also points you at the rox documentation for the extensive discussion of the Choices mechanism β that's where the deep lore lives π₯
and that's the whole page, bestie! π source/version and date, as promised: this is perl v5.42.0, dated 2024-04-26, from the File::M...nfo::Rox(3) manual page π mwah, go open some files π
π¦ where this page comes from
- opensuse-leap 16.0: perl-File-MimeInfo 0.350.0-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms