Dancer::MIME - Singleton object to handle MimeTypes
# 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);
my $mime = Dancer::MIME->instance();
return the Dancer::MIME instance object.
$mime->add_mime_type( foo => "text/foo" );
Adds a non standard mime type.
$mime->add_mime_alias( my_jpg => 'jpg' );
Add an alias to a standard or non standard mime type.
$mime->mime_type_for( 'jpg' );
Retrieve the mime type for a standard or non standard mime type.
$my_aliases = $mime->aliases;
Retrieve the full hash table of added mime types and aliases.
To install Dancer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer
CPAN shell
perl -MCPAN -e shell install Dancer
For more information on module installation, please visit the detailed CPAN module installation guide.