1Mail::Cap(3) User Contributed Perl Documentation Mail::Cap(3)
2
3
4
6 Mail::Cap - Parse mailcap files
7
10 my $mc = new Mail::Cap;
11 $desc = $mc->description('image/gif');
12
13 print "GIF desc: $desc\n";
14 $cmd = $mc->viewCmd('text/plain; charset=iso-8859-1', 'file.txt');
15
17 Parse mailcap files as specified in "RFC 1524 --A User Agent
18 Configuration Mechanism For Multimedia Mail Format Information>. In
19 the description below $type refers to the MIME type as specified in the
20 "Content-Type" header of mail or HTTP messages. Examples of types are:
21
22 image/gif
23 text/html
24 text/plain; charset=iso-8859-1
25
26 You could also take a look at the File::MimeInfo distribution, which
27 are accessing tables which are used by many applications on a system,
28 and therefore have succeeded the mail-cap specifications on modern
29 (UNIX) systems.
30
32 Constructors
33 Mail::Cap->new(OPTIONS)
34
35 Create and initialize a new Mail::Cap object. If you give it an
36 argument it will try to parse the specified file. Without any
37 arguments it will search for the mailcap file using the standard
38 mailcap path, or the MAILCAPS environment variable if it is
39 defined.
40
41 Option --Default
42 filename undef
43 take 'FIRST'
44
45 . filename => FILENAME
46
47 Add the specified file to the list to standard locations. This
48 file is tried first.
49
50 . take => 'ALL'|'FIRST'
51
52 Include all mailcap files you can find. By default, only the
53 first file is parsed, however the RFC tells us to include ALL.
54 To maintain backwards compatibility, the default only takes the
55 FIRST.
56
57 example:
58
59 $mcap = new Mail::Cap;
60 $mcap = new Mail::Cap "/mydir/mailcap";
61 $mcap = new Mail::Cap filename => "/mydir/mailcap";
62 $mcap = new Mail::Cap take => 'ALL';
63 $mcap = Mail::Cap->new(take => 'ALL');
64
65 Run commands
66 These methods invoke a suitable progam presenting or manipulating the
67 media object in the specified file. They all return 1 if a command was
68 found, and 0 otherwise. You might test $? for the outcome of the
69 command.
70
71 $obj->compose(TYPE, FILE)
72
73 $obj->edit(TYPE, FILE)
74
75 $obj->print(TYPE, FILE)
76
77 $obj->view(TYPE, FILE)
78
79 Command creator
80 These methods return a string that is suitable for feeding to system()
81 in order to invoke a suitable progam presenting or manipulating the
82 media object in the specified file. It will return "undef" if no
83 suitable specification exists.
84
85 $obj->composeCmd(TYPE, FILE)
86
87 $obj->editCmd(TYPE, FILE)
88
89 $obj->printCmd(TYPE, FILE)
90
91 $obj->viewCmd(TYPE, FILE)
92
93 Look-up definitions
94 Methods return the corresponding mailcap field for the type.
95
96 $obj->description(TYPE)
97
98 $obj->field(TYPE, FIELD)
99
100 Returns the specified field for the type. Returns undef if no
101 specification exsists.
102
103 $obj->nametemplate(TYPE)
104
105 $obj->textualnewlines(TYPE)
106
107 $obj->x11_bitmap(TYPE)
108
110 This module is part of the MailTools distribution,
111 http://perl.overmeer.net/mailtools/.
112
114 The MailTools bundle was developed by Graham Barr. Later, Mark
115 Overmeer took over maintenance without commitment to further
116 development.
117
118 Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by
119 Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce
120 <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
121
123 Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark
124 Overmeer <perl@overmeer.net>.
125
126 This program is free software; you can redistribute it and/or modify it
127 under the same terms as Perl itself. See
128 http://www.perl.com/perl/misc/Artistic.html
129
130
131
132perl v5.10.1 2008-07-29 Mail::Cap(3)