LWP::MediaTypes man page on BSDi

Man page or keyword search:  
man Server   6284 pages
apropos Keyword Search (all sections)
Output format
BSDi logo
[printable version]



lib::LWP::MediaUsersContributed Perl Documlib::LWP::MediaTypes(3)

NAME
       guess_media_type - guess media type for a file or a URL.

       media_suffix - returns file extentions for a media type

SYNOPSIS
	use LWP::MediaTypes qw(guess_media_type);
	$type = guess_media_type("/tmp/foo.gif");

DESCRIPTION
       This module provides functions for handling of media (also
       known as MIME) types and encodings.  The mapping from file
       extentions to media types is defined by the media.types
       file.  If the ~/.media.types file exist it is used as a
       replacement.

       For backwards compatability we will also look for
       ~/.mime.types.

FUNCTIONS
       guess_media_type($filename_or_url, [$header_to_modify])

       This function tries to guess media type and encoding for
       given file.  In scalar context it returns only the
       content-type.  In array context it returns an array
       consisting of content-type followed by any content-
       encodings applied.

       The guess_media_type function also accepts a URI::URL
       object as argument.

       If the type can not be deduced from looking at the file
       name only, then guess_media_type() will take a look at the
       actual file using the -T perl operator in order to
       determine if this is a text file (text/plain).  If this
       does not work it will return application/octet-stream as
       the type.

       The optional second argument should be a reference to a
       HTTP::Headers object (or some HTTP::Message object).  When
       present this function will set the value of the 'Content-
       Type' and 'Content-Encoding' for this header.

       media_suffix($type,...)

       This function will return all suffixes that can be used to
       denote the specified media type(s).  Wildcard types can be
       used.  In scalar context it will return the first suffix
       found.

       Examples:

24/Aug/1997	       perl 5.005, patch 03			1

lib::LWP::MediaUsersContributed Perl Documlib::LWP::MediaTypes(3)

	 @suffixes = media_suffix('image/*', 'audio/basic');
	 $suffix = media_suffix('text/html');

24/Aug/1997	       perl 5.005, patch 03			2

[top]

List of man pages available for BSDi

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net