The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Dancer::MIME - Singleton object to handle MimeTypes

SYNOPSIS

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

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

    # add an alias
    $mime->add_mime_alias( bar => "foo" );

    # get mime type for standard or non standard types
    $nonstandard_type = $mime->mime_type_for('foo');
    $standard_type = $mime->mime_type_for('svg');
    my $response = Dancer::SharedData->response->status(200);

PUBLIC API

instance

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

return the Dancer::MIME instance object.

add_mime_type

    $mime->add_mime_type( foo => "text/foo" );

Adds a non standard mime type.

add_mime_alias

    $mime->add_mime_alias( my_jpg => 'jpg' );

Add an alias to a standard or non standard mime type.

mime_type_for

    $mime->mime_type_for( 'jpg' );

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

aliases

    $my_aliases = $mime->aliases;

Retrieve the full hash table of added mime types and aliases.