GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Dancer::MIME(3) User Contributed Perl Documentation Dancer::MIME(3)

Dancer::MIME - Singleton object to handle MimeTypes

version 1.3513

    # retrieve object instance
    my $mime = Data::MIME->instance();

    # return a hash reference of user defined types
    my $types = $mime->custom_types;

    # return the default mime-type for unknown files
    $mime->default

    # set the default mime-type with Dancer::Config or Dancer, like
    set default_mime_type => "text/plain";
    # or directly in your config.yml file.

    # add non standard mime type
    $mime->add_type( foo => "text/foo" );

    # add an alias to an existing type
    $mime->add_alias( bar => "foo" );

    # get mime type for standard or non standard types
    $nonstandard_type = $mime->for_name('foo');
    $standard_type    = $mime->for_name('svg');

    # get mime type for a file (given the extension)
    $mime_type = $mime->for_file("foo.bar");

    my $mime = Dancer::MIME->instance();

return the Dancer::MIME instance object.

    # add nonstandard mime type
    $mime->add_type( foo => "text/foo" );

Add a non standard mime type or overrides an existing one.

    # add alias to standard or previous alias
    $mime->add_alias( my_jpg => 'jpg' );

Adds an alias to an existing mime type.

    $mime->for_name( 'jpg' );

Retrieve the mime type for a standard or non standard mime type.

    $mime->for_file( 'file.jpg' );

Retrieve the mime type for a file, based on a file extension.

    my $types = $mime->custom_types;

Retrieve the full hash table of added mime types.

    my $type = $mime->name_or_type($thing);

Resolves the $thing into a content $type whether it's the name of a MIME type like "txt" or already a mime type like "text/plain".

This module has been written and rewritten by different people from Dancer project.

This module is released under the same terms as Perl itself.

Dancer

Dancer Core Developers

This software is copyright (c) 2010 by Alexis Sukrieh.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2020-01-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.