1Mail::Cap(3)          User Contributed Perl Documentation         Mail::Cap(3)
2
3
4

NAME

6       Mail::Cap - Parse mailcap files
7

SYNOPSIS

9           my $mc = new Mail::Cap;
10
11           $desc = $mc->description('image/gif');
12
13           print "GIF desc: $desc\n";
14
15           $cmd = $mc->viewCmd('text/plain; charset=iso-8859-1', 'file.txt');
16

DESCRIPTION

18       Parse mailcap files as specified in RFC 1524 - A User Agent Configura‐
19       tion Mechanism For Multimedia Mail Format Information.  In the descrip‐
20       tion below $type refers to the MIME type as specified in the Content-
21       Type header of mail or HTTP messages.  Examples of types are:
22
23         image/gif
24         text/html
25         text/plain; charset=iso-8859-1
26

METHODS

28       new(OPTIONS)
29
30         $mcap = new Mail::Cap;
31         $mcap = new Mail::Cap "/mydir/mailcap";
32         $mcap = new Mail::Cap filename => "/mydir/mailcap";
33         $mcap = new Mail::Cap take => 'ALL';
34         $mcap = Mail::Cap->new(take => 'ALL');
35
36       Create and initialize a new Mail::Cap object.  If you give it an argu‐
37       ment it will try to parse the specified file.  Without any arguments it
38       will search for the mailcap file using the standard mailcap path, or
39       the MAILCAPS environment variable if it is defined.
40
41       There is currently two OPTION implemented:
42
43       * take => 'ALL'⎪'FIRST'
44           Include all mailcap files you can find.  By default, only the first
45           file is parsed, however the RFC tells us to include ALL.  To main‐
46           tain backwards compatibility, the default only takes the FIRST.
47
48       * filename => FILENAME
49           Add the specified file to the list to standard locations.  This
50           file is tried first.
51
52       view($type, $file)
53
54       compose($type, $file)
55
56       edit($type, $file)
57
58       print($type, $file)
59
60       These methods invoke a suitable progam presenting or manipulating the
61       media object in the specified file.  They all return 1 if a command was
62       found, and 0 otherwise.  You might test $? for the outcome of the com‐
63       mand.
64
65       viewCmd($type, $file)
66
67       composeCmd($type, $file)
68
69       editCmd($type, $file)
70
71       printCmd($type, $file)
72
73       These methods return a string that is suitable for feeding to system()
74       in order to invoke a suitable progam presenting or manipulating the
75       media object in the specified file.  It will return "undef" if no suit‐
76       able specification exists.
77
78       field($type, $field)
79
80       Returns the specified field for the type.  Returns undef if no specifi‐
81       cation exsists.
82
83       description($type)
84
85       textualnewlines($type)
86
87       x11_bitmap($type)
88
89       nametemplate($type)
90
91       These methods return the corresponding mailcap field for the type.
92       These methods should be more convenient to use than the field() method
93       for the same fields.
94
96       Copyright (c) 1995 Gisle Aas. All rights reserved.
97
98       This library is free software; you can redistribute it and/or modify it
99       under the same terms as Perl itself.
100

AUTHOR

102       Gisle Aas <aas@oslonett.no>
103
104       Modified by Graham Barr <gbarr@pobox.com>
105
106       Maintained by Mark Overmeer <mailtools@overmeer.net>
107
108
109
110perl v5.8.8                       2007-05-11                      Mail::Cap(3)
Impressum