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

SEE ALSO

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

AUTHORS

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

LICENSE

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