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

NAME

6       Mail::Cap - understand mailcap files
7

SYNOPSIS

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

DESCRIPTION

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

METHODS

32   Constructors
33       Mail::Cap->new(%options)
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             Add the specified file to the list to standard locations.  This
46             file is tried first.
47
48           take => 'ALL'|'FIRST'
49             Include all mailcap files you can find.  By default, only the
50             first file is parsed, however the RFC tells us to include ALL.
51             To maintain backwards compatibility, the default only takes the
52             FIRST.
53
54           example:
55
56             $mcap = new Mail::Cap;
57             $mcap = new Mail::Cap "/mydir/mailcap";
58             $mcap = new Mail::Cap filename => "/mydir/mailcap";
59             $mcap = new Mail::Cap take => 'ALL';
60             $mcap = Mail::Cap->new(take => 'ALL');
61
62   Run commands
63       These methods invoke a suitable program presenting or manipulating the
64       media object in the specified file.  They all return 1 if a command was
65       found, and 0 otherwise.  You might test $? for the outcome of the
66       command.
67
68       $obj->compose($type, $file)
69       $obj->edit($type, $file)
70       $obj->print($type, $file)
71       $obj->view($type, $file)
72
73   Command creator
74       These methods return a string that is suitable for feeding to system()
75       in order to invoke a suitable program presenting or manipulating the
76       media object in the specified file.  It will return "undef" if no
77       suitable specification exists.
78
79       $obj->composeCmd($type, $file)
80       $obj->editCmd($type, $file)
81       $obj->printCmd($type, $file)
82       $obj->viewCmd($type, $file)
83
84   Look-up definitions
85       Methods return the corresponding mailcap field for the type.
86
87       $obj->description($type)
88       $obj->field($type, $field)
89           Returns the specified field for the type.  Returns undef if no
90           specification exists.
91
92       $obj->nametemplate($type)
93       $obj->textualnewlines($type)
94       $obj->x11_bitmap($type)
95

SEE ALSO

97       This module is part of the MailTools distribution,
98       http://perl.overmeer.net/mailtools/.
99

AUTHORS

101       The MailTools bundle was developed by Graham Barr.  Later, Mark
102       Overmeer took over maintenance without commitment to further
103       development.
104
105       Mail::Cap by Gisle Aas <aas@oslonett.no>.  Mail::Field::AddrList by
106       Peter Orbaek <poe@cit.dk>.  Mail::Mailer and Mail::Send by Tim Bunce
107       <Tim.Bunce@ig.co.uk>.  For other contributors see ChangeLog.
108

LICENSE

110       Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2017 Mark
111       Overmeer <perl@overmeer.net>.
112
113       This program is free software; you can redistribute it and/or modify it
114       under the same terms as Perl itself.  See
115       http://www.perl.com/perl/misc/Artistic.html
116
117
118
119perl v5.32.0                      2020-07-28                      Mail::Cap(3)
Impressum