MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/local/ssl/local/share/man/man3/MIME::Type.3
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  | will give a
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "MIME::Type 3"
.TH MIME::Type 3 "2010-03-16" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
MIME::Type \- Definition of one MIME type
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 5
\& use MIME::Types;
\& my $mimetypes = MIME::Types->new;
\& my MIME::Type $plaintext = $mimetypes->type('text/plain');
\& print $plaintext->mediaType;   # text
\& print $plaintext->subType;     # plain
.Ve
.PP
.Vb 2
\& my @ext = $plaintext->extensions;
\& print "@ext"                   # txt asc c cc h hh cpp
.Ve
.PP
.Vb 5
\& print $plaintext->encoding     # 8bit
\& if($plaintext->isBinary)       # false
\& if($plaintext->isAscii)        # true
\& if($plaintext->equals('text/plain') {...}
\& if($plaintext eq 'text/plain') # same
.Ve
.PP
.Vb 1
\& print MIME::Type->simplified('x-appl/x-zip') #  'appl/zip'
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\s-1MIME\s0 types are used in \s-1MIME\s0 entities, for instance as part of e\-mail
and \s-1HTTP\s0 traffic.  Sometimes real knowledge about a mime-type is need.
Objects of \f(CW\*(C`MIME::Type\*(C'\fR store the information on one such type.
.PP
This module is built to conform to the \s-1MIME\s0 types of \s-1RFC\s0's 2045 and 2231.
It follows the official \s-1IANA\s0 registry at
\&\fIhttp://www.iana.org/assignments/media\-types/\fR
and the collection kept at \fIhttp://www.ltsw.se/knbase/internet/mime.htp\fR
.SH "OVERLOADED"
.IX Header "OVERLOADED"
overload: \fBstring comparison\fR
.Sp
.RS 4
When a MIME::Type object is compared to either a string or an other
MIME::TYpe, the \fIequals()\fR method is called.  Comparison is smart,
which means that it extends common string comparison with some
features which are defined in the related RFCs.
.RE
.PP
overload: \fBstringification\fR
.Sp
.RS 4
The stringification (use of the object in a place where a string
is required) will result in the type name, the same as \fItype()\fR
returns.
.Sp
example: use of stringification
.Sp
.Vb 3
\& my $mime = MIME::Type->new('text/html');
\& print "$mime\en";   # explicit stringification
\& print $mime;       # implicit stringification
.Ve
.RE
.SH "METHODS"
.IX Header "METHODS"
.Sh "Initiation"
.IX Subsection "Initiation"
MIME::Type\->\fBnew\fR(\s-1OPTIONS\s0)
.Sp
.RS 4
Create (\fIinstantiate\fR) a new MIME::Type object which manages one
mime type.
.Sp
.Vb 6
\& Option    --Default
\& encoding    <depends on type>
\& extensions  []
\& simplified  <derived from type>
\& system      undef
\& type        <required>
.Ve
.Sp
\&. encoding => '7bit'|'8bit'|'base64'|'quoted\-printable'
.Sp
.RS 4
How must this data be encoded to be transported safely.  The default
depends on the type: mimes with as main type \f(CW\*(C`text/\*(C'\fR will default
to \f(CW\*(C`quoted\-printable\*(C'\fR and all other to \f(CW\*(C`base64\*(C'\fR.
.RE
.RE
.RS 4
.Sp
\&. extensions => REF-ARRAY
.Sp
.RS 4
An array of extensions which are using this mime.
.RE
.RE
.RS 4
.Sp
\&. simplified => \s-1STRING\s0
.Sp
.RS 4
The mime types main\- and sub-label can both start with \f(CW\*(C`x\-\*(C'\fR, to indicate
that is a non-registered name.  Of course, after registration this flag
can disappear which adds to the confusion.  The simplified string has the
\&\f(CW\*(C`x\-\*(C'\fR thingies removed and are translated to lower\-case.
.RE
.RE
.RS 4
.Sp
\&. system => \s-1REGEX\s0
.Sp
.RS 4
Regular expression which defines for which systems this rule is valid.  The
\&\s-1REGEX\s0 is matched on \f(CW$^O\fR.
.RE
.RE
.RS 4
.Sp
\&. type => \s-1STRING\s0
.Sp
.RS 4
The type which is defined here.  It consists of a \fItype\fR and a \fIsub-type\fR,
both case\-insensitive.  This module will return lower\-case, but accept
upper\-case.
.RE
.RE
.RS 4
.RE
.Sh "Attributes"
.IX Subsection "Attributes"
$obj\->\fBencoding\fR
.Sp
.RS 4
Returns the type of encoding which is required to transport data of this
type safely.
.RE
.PP
$obj\->\fBextensions\fR
.Sp
.RS 4
Returns a list of extensions which are known to be used for this
mime type.
.RE
.PP
$obj\->\fBsimplified\fR([\s-1STRING\s0])
.PP
MIME::Type\->\fBsimplified\fR([\s-1STRING\s0])
.Sp
.RS 4
Returns the simplified mime type for this object or the specified \s-1STRING\s0.
Mime type names can get officially registered.  Until then, they have to
carry an \f(CW\*(C`x\-\*(C'\fR preamble to indicate that.  Of course, after recognition,
the \f(CW\*(C`x\-\*(C'\fR can disappear.  In many cases, we prefer the simplified version
of the type.
.Sp
example: results of \fIsimplified()\fR
.Sp
.Vb 4
\& my $mime = MIME::Type->new(type => 'x-appl/x-zip');
\& print $mime->simplified;                     # 'appl/zip'
\& print $mime->simplified('text/plain');       # 'text/plain'
\& print MIME::Type->simplified('x-xyz/x-abc'); # 'xyz/abc'
.Ve
.RE
.PP
$obj\->\fBsystem\fR
.Sp
.RS 4
Returns the regular expression which can be used to determine whether this
type is active on the system where you are working on.
.RE
.PP
$obj\->\fBtype\fR
.Sp
.RS 4
Returns the long type of this object, for instance \f(CW'text/plain'\fR
.RE
.Sh "Knowledge"
.IX Subsection "Knowledge"
$obj\->\fBequals\fR(STRING|MIME)
.Sp
.RS 4
Compare this mime-type object with a \s-1STRING\s0 or other object.  In case of
a \s-1STRING\s0, simplification will take place.
.RE
.PP
$obj\->\fBisAscii\fR
.Sp
.RS 4
Returns false when the encoding is base64, and true otherwise.  All encodings
except base64 are text encodings.
.RE
.PP
$obj\->\fBisBinary\fR
.Sp
.RS 4
Returns true when the encoding is base64.
.RE
.PP
$obj\->\fBisRegistered\fR
.Sp
.RS 4
Mime-types which are not registered by \s-1IANA\s0 nor defined in RFCs shall
start with an \f(CW\*(C`x\-\*(C'\fR.  This counts for as well the media-type as the
sub\-type.  In case either one of the types starts with \f(CW\*(C`x\-\*(C'\fR this
method will return false.
.RE
.PP
$obj\->\fBisSignature\fR
.Sp
.RS 4
Returns true when the type is in the list of known signatures.
.RE
.PP
$obj\->\fBmediaType\fR
.Sp
.RS 4
The media type of the simplified mime.
For \f(CW'text/plain'\fR it will return \f(CW'text'\fR.
.Sp
For historical reasons, the \f(CW'mainType'\fR method still can be used
to retreive the same value.  However, that method is deprecated.
.RE
.PP
$obj\->\fBsubType\fR
.Sp
.RS 4
The sub type of the simplified mime.
For \f(CW'text/plain'\fR it will return \f(CW'plain'\fR.
.RE
.SH "DIAGNOSTICS"
.IX Header "DIAGNOSTICS"
Error: Type parameter is obligatory.
.Sp
.RS 4
When a MIME::Type object is created, the type itself must be
specified with the \f(CW\*(C`type\*(C'\fR option flag.
.RE
.SH "SEE ALSO"
.IX Header "SEE ALSO"
This module is part of MIME-Types distribution version 1.29,
built on March 16, 2010. Website: \fIhttp://perl.overmeer.net/mimetypes/\fR
.SH "LICENSE"
.IX Header "LICENSE"
Copyrights 1999,2001\-2010 by Mark Overmeer. For other contributors see ChangeLog.
.PP
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See \fIhttp://www.perl.com/perl/misc/Artistic.html\fR