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        $desc = $mc->description('image/gif');
11
12        print "GIF desc: $desc\n";
13        $cmd = $mc->viewCmd('text/plain; charset=iso-8859-1', 'file.txt');
14

DESCRIPTION

16       Parse mailcap files as specified in "RFC 1524 --A User Agent
17       Configuration Mechanism For Multimedia Mail Format Information>.  In
18       the description below $type refers to the MIME type as specified in the
19       "Content-Type" header of mail or HTTP messages.  Examples of types are:
20
21         image/gif
22         text/html
23         text/plain; charset=iso-8859-1
24
25       You could also take a look at the File::MimeInfo distribution, which
26       are accessing tables which are used by many applications on a system,
27       and therefore have succeeded the mail-cap specifications on modern
28       (UNIX) systems.
29

METHODS

31   Constructors
32       Mail::Cap->new(OPTIONS)
33
34           Create and initialize a new Mail::Cap object.  If you give it an
35           argument it will try to parse the specified file.  Without any
36           arguments it will search for the mailcap file using the standard
37           mailcap path, or the MAILCAPS environment variable if it is
38           defined.
39
40            Option  --Default
41            filename  undef
42            take      'FIRST'
43
44           . filename => FILENAME
45
46               Add the specified file to the list to standard locations.  This
47               file is tried first.
48
49           . take => 'ALL'|'FIRST'
50
51               Include all mailcap files you can find.  By default, only the
52               first file is parsed, however the RFC tells us to include ALL.
53               To maintain backwards compatibility, the default only takes the
54               FIRST.
55
56           example:
57
58             $mcap = new Mail::Cap;
59             $mcap = new Mail::Cap "/mydir/mailcap";
60             $mcap = new Mail::Cap filename => "/mydir/mailcap";
61             $mcap = new Mail::Cap take => 'ALL';
62             $mcap = Mail::Cap->new(take => 'ALL');
63
64   Run commands
65       These methods invoke a suitable progam presenting or manipulating the
66       media object in the specified file.  They all return 1 if a command was
67       found, and 0 otherwise.  You might test $? for the outcome of the
68       command.
69
70       $obj->compose(TYPE, FILE)
71
72       $obj->edit(TYPE, FILE)
73
74       $obj->print(TYPE, FILE)
75
76       $obj->view(TYPE, FILE)
77
78   Command creator
79       These methods return a string that is suitable for feeding to system()
80       in order to invoke a suitable progam presenting or manipulating the
81       media object in the specified file.  It will return "undef" if no
82       suitable specification exists.
83
84       $obj->composeCmd(TYPE, FILE)
85
86       $obj->editCmd(TYPE, FILE)
87
88       $obj->printCmd(TYPE, FILE)
89
90       $obj->viewCmd(TYPE, FILE)
91
92   Look-up definitions
93       Methods return the corresponding mailcap field for the type.
94
95       $obj->description(TYPE)
96
97       $obj->field(TYPE, FIELD)
98
99           Returns the specified field for the type.  Returns undef if no
100           specification exsists.
101
102       $obj->nametemplate(TYPE)
103
104       $obj->textualnewlines(TYPE)
105
106       $obj->x11_bitmap(TYPE)
107

SEE ALSO

109       This module is part of the MailTools distribution,
110       http://perl.overmeer.net/mailtools/.
111

AUTHORS

113       The MailTools bundle was developed by Graham Barr.  Later, Mark
114       Overmeer took over maintenance without commitment to further
115       development.
116
117       Mail::Cap by Gisle Aas <aas@oslonett.no>.  Mail::Field::AddrList by
118       Peter Orbaek <poe@cit.dk>.  Mail::Mailer and Mail::Send by Tim Bunce
119       <Tim.Bunce@ig.co.uk>.  For other contributors see ChangeLog.
120

LICENSE

122       Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark
123       Overmeer <perl@overmeer.net>.
124
125       This program is free software; you can redistribute it and/or modify it
126       under the same terms as Perl itself.  See
127       http://www.perl.com/perl/misc/Artistic.html
128
129
130
131perl v5.12.2                      2010-10-01                      Mail::Cap(3)
Impressum