303 lines
6.2 KiB
HTML
303 lines
6.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Mail::Cap</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Mail::Cap</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-07-25<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Mail::Cap - understand mailcap files
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
my $mc = Mail::Cap->new;
|
|
|
|
my $desc = $mc->description('image/gif');
|
|
print "GIF desc: $desc\n";
|
|
|
|
my $cmd = $mc->viewCmd('text/plain; charset=iso-8859-1', 'file.txt');
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
Parse mailcap files as specified in "<FONT SIZE="-1">RFC 1524</FONT> --A User Agent
|
|
Configuration Mechanism For Multimedia Mail Format Information>. In
|
|
the description below <TT>$type</TT> refers to the <FONT SIZE="-1">MIME</FONT> type as specified in
|
|
the <TT>"Content-Type"</TT> header of mail or <FONT SIZE="-1">HTTP</FONT> messages. Examples of
|
|
types are:
|
|
<P>
|
|
|
|
|
|
|
|
<PRE>
|
|
image/gif
|
|
text/html
|
|
text/plain; charset=iso-8859-1
|
|
|
|
</PRE>
|
|
|
|
|
|
<P>
|
|
|
|
You could also take a look at the File::MimeInfo distribution, which
|
|
are accessing tables which are used by many applications on a system,
|
|
and therefore have succeeded the mail-cap specifications on modern
|
|
(<FONT SIZE="-1">UNIX</FONT>) systems.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>METHODS</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Constructors</H3>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">Mail::Cap-><B>new</B>(%options)<DD>
|
|
|
|
|
|
Create and initialize a new Mail::Cap object. If you give it an
|
|
argument it will try to parse the specified file. Without any
|
|
arguments it will search for the mailcap file using the standard
|
|
mailcap path, or the <FONT SIZE="-1">MAILCAPS</FONT> environment variable if it is defined.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
-Option --Default
|
|
filename undef
|
|
take 'FIRST'
|
|
|
|
</PRE>
|
|
|
|
|
|
<DL COMPACT><DT id="2"><DD>
|
|
<DL COMPACT>
|
|
<DT id="3">filename => <FONT SIZE="-1">FILENAME</FONT><DD>
|
|
|
|
|
|
Add the specified file to the list to standard locations. This file
|
|
is tried first.
|
|
<DT id="4">take => '<FONT SIZE="-1">ALL</FONT>'|'<FONT SIZE="-1">FIRST</FONT>'<DD>
|
|
|
|
|
|
Include all mailcap files you can find. By default, only the first
|
|
file is parsed, however the <FONT SIZE="-1">RFC</FONT> tells us to include <FONT SIZE="-1">ALL.</FONT> To maintain
|
|
backwards compatibility, the default only takes the <FONT SIZE="-1">FIRST.</FONT>
|
|
</DL>
|
|
</DL>
|
|
|
|
<DL COMPACT><DT id="5"><DD>
|
|
|
|
|
|
<P>
|
|
|
|
|
|
example:
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
$mcap = new Mail::Cap;
|
|
$mcap = new Mail::Cap "/mydir/mailcap";
|
|
$mcap = new Mail::Cap filename => "/mydir/mailcap";
|
|
$mcap = new Mail::Cap take => 'ALL';
|
|
$mcap = Mail::Cap->new(take => 'ALL');
|
|
|
|
</PRE>
|
|
|
|
|
|
</DL>
|
|
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Run commands</H3>
|
|
|
|
|
|
|
|
These methods invoke a suitable program presenting or manipulating the
|
|
media object in the specified file. They all return <TT>1</TT> if a command
|
|
was found, and <TT>0</TT> otherwise. You might test <TT>$?</TT> for the outcome
|
|
of the command.
|
|
<DL COMPACT>
|
|
<DT id="6">$obj-><B>compose</B>($type, $file)<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="7">$obj-><B>edit</B>($type, $file)<DD>
|
|
|
|
|
|
|
|
|
|
<DT id="8">$obj-><B>print</B>($type, $file)<DD>
|
|
|
|
|
|
|
|
|
|
<DT id="9">$obj-><B>view</B>($type, $file)<DD>
|
|
|
|
|
|
|
|
|
|
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Command creator</H3>
|
|
|
|
|
|
|
|
These methods return a string that is suitable for feeding to <B>system()</B>
|
|
in order to invoke a suitable program presenting or manipulating the
|
|
media object in the specified file. It will return <TT>"undef"</TT> if no
|
|
suitable specification exists.
|
|
<DL COMPACT>
|
|
<DT id="10">$obj-><B>composeCmd</B>($type, $file)<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="11">$obj-><B>editCmd</B>($type, $file)<DD>
|
|
|
|
|
|
|
|
|
|
<DT id="12">$obj-><B>printCmd</B>($type, $file)<DD>
|
|
|
|
|
|
|
|
|
|
<DT id="13">$obj-><B>viewCmd</B>($type, $file)<DD>
|
|
|
|
|
|
|
|
|
|
|
|
</DL>
|
|
<A NAME="lbAI"> </A>
|
|
<H3>Look-up definitions</H3>
|
|
|
|
|
|
|
|
Methods return the corresponding mailcap field for the type.
|
|
<DL COMPACT>
|
|
<DT id="14">$obj-><B>description</B>($type)<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="15">$obj-><B>field</B>($type, $field)<DD>
|
|
|
|
|
|
|
|
|
|
|
|
Returns the specified field for the type. Returns undef if no
|
|
specification exists.
|
|
<DT id="16">$obj-><B>nametemplate</B>($type)<DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="17">$obj-><B>textualnewlines</B>($type)<DD>
|
|
|
|
|
|
|
|
|
|
<DT id="18">$obj-><B>x11_bitmap</B>($type)<DD>
|
|
|
|
|
|
|
|
|
|
|
|
</DL>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
This module is part of the MailTools distribution,
|
|
<I><A HREF="http://perl.overmeer.net/mailtools/">http://perl.overmeer.net/mailtools/</A></I>.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>AUTHORS</H2>
|
|
|
|
|
|
|
|
The MailTools bundle was developed by Graham Barr. Later, Mark
|
|
Overmeer took over maintenance without commitment to further development.
|
|
<P>
|
|
|
|
Mail::Cap by Gisle Aas <<A HREF="mailto:aas@oslonett.no">aas@oslonett.no</A>>.
|
|
Mail::Field::AddrList by Peter Orbaek <<A HREF="mailto:poe@cit.dk">poe@cit.dk</A>>.
|
|
Mail::Mailer and Mail::Send by Tim Bunce <<A HREF="mailto:Tim.Bunce@ig.co.uk">Tim.Bunce@ig.co.uk</A>>.
|
|
For other contributors see ChangeLog.
|
|
<A NAME="lbAL"> </A>
|
|
<H2>LICENSE</H2>
|
|
|
|
|
|
|
|
Copyrights 1995-2000 Graham Barr <<A HREF="mailto:gbarr@pobox.com">gbarr@pobox.com</A>> and
|
|
2001-2017 Mark Overmeer <<A HREF="mailto:perl@overmeer.net">perl@overmeer.net</A>>.
|
|
<P>
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
|
under the same terms as Perl itself.
|
|
See <I><A HREF="http://www.perl.com/perl/misc/Artistic.html">http://www.perl.com/perl/misc/Artistic.html</A></I>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="19"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="20"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="21"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="22"><A HREF="#lbAE">METHODS</A><DD>
|
|
<DL>
|
|
<DT id="23"><A HREF="#lbAF">Constructors</A><DD>
|
|
<DT id="24"><A HREF="#lbAG">Run commands</A><DD>
|
|
<DT id="25"><A HREF="#lbAH">Command creator</A><DD>
|
|
<DT id="26"><A HREF="#lbAI">Look-up definitions</A><DD>
|
|
</DL>
|
|
<DT id="27"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="28"><A HREF="#lbAK">AUTHORS</A><DD>
|
|
<DT id="29"><A HREF="#lbAL">LICENSE</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:47 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|