1File::MimeInfo::Rox(3)User Contributed Perl DocumentationFile::MimeInfo::Rox(3)
2
3
4
6 File::MimeInfo::Rox - Open files by mimetype "Rox style"
7
9 use File::MimeInfo::Magic;
10 use File::MimeInfo::Rox qw/:magic/;
11
12 # open some file with the appropriate program
13 mime_system($somefile);
14
15 # more verbose version
16 my $mt = mimetype($somefile)
17 || die "Could not find mimetype for $somefile\n";
18 mime_system($somefile, $mt)
19 || die "No program to open $somefile available\n";
20
22 This module tries to mimic the behaviour of the rox file browser
23 <http://rox.sf.net> when "opening" data files. It determines the mime
24 type and searches in rox's "Choices" directories for a program to
25 handle that mimetype.
26
27 See the rox documentation for an extensive discussion of this
28 mechanism.
29
31 The methods "mime_exec" and "mime_system" are exported, if you use the
32 export tag ":magic" you get the same methods but File::MimeInfo::Magic
33 will be used for mimetype lookup.
34
36 The environment variable "CHOICESPATH" is used when searching for rox's
37 config dirs. It defaults to
38 "$ENV{HOME}/Choices:/usr/local/share/Choices:/usr/share/Choices"
39
41 "mime_system($file)"
42 "mime_system($file, $mimetype, @_)"
43 Try to open $file with the appropriate program for files of it's
44 mimetype. You can use $mimetype to force the mimetype. Also if you
45 already know the mimetype it saves a lot of time to just tell it.
46
47 If either the mimetype couldn't be determined or no appropriate
48 program could be found "undef" is returned. If the actual system
49 fails an exception is raised.
50
51 All remaining arguments are passed on to the handler.
52
53 "mime_exec($file)"
54 "mime_exec($file, $mimetype, @_)"
55 Like "mime_system()" but uses exec instead of system, so it never
56 returns if successful.
57
58 "suggest_script_name($mimetype)"
59 Returns the list "($dir, $file)" for the suggested place to write
60 new script files (or symlinks) for mimetype $mimetype. The
61 suggested dir doesn't need to exist.
62
64 Jaap Karssenberg <pardus@cpan.org> Maintained by Michiel Beijen
65 <michiel.beijen@gmail.com>
66
68 Copyright (c) 2003, 2012 Jaap G Karssenberg. All rights reserved. This
69 program is free software; you can redistribute it and/or modify it
70 under the same terms as Perl itself.
71
73 File::MimeInfo, File::MimeInfo::Magic, <http://rox.sourceforce.net>
74
75
76
77perl v5.30.0 2019-07-26 File::MimeInfo::Rox(3)