Dancer2...re::MIME(3)
π Dancer2::Core::MIME β the manual, but make it a group chat π
okay bestie, sit down, hydrate, and let me tell you about Dancer2::Core::MIME (that's the Dancer2...re::MIME(3) page, she's just got a long name and the terminal cut her off, it's giving β¨abbreviatedβ¨). This is the class that makes MIME types not a whole nightmare. π¦
πΈ NAME πΈ
Dancer2::Core::MIME β a class to ease manipulation of MIME types. literally that's her whole job and she's slaying it π
β VERSION β
version 2.2.1 β periodt, that's the one we're on π
π SYNOPSIS π
here's the vibe, code and all, verbatim because I would never mess with your copy-paste:
use Dancer2::Core::MIME;
my $mime = Dancer2::Core::MIME->new();
# get mime type for an alias
my $type = $mime->for_name('css');
# set a new mime type
my $type = $mime->add_type( foo => 'text/foo' );
# set a mime type alias
my $alias = $mime->add_alias( f => 'foo' );
# get mime type for a file (based on extension)
my $file = $mime->for_file( "foo.bar" );
# set the $thing into a content $type.
my $type = $mime->name_or_type($thing);
# get current defined default mime type
my $type = $mime->default;
# set the default mime type using config.yml
# or using the set keyword
set default_mime_type => 'text/plain';
look at her go. main character energy fr fr π₯
π¦ DESCRIPTION π¦
Dancer2::Core::MIME is a thin wrapper around MIME::Types, and what it does is hand you a bunch of helpful methods for MIME handling. that's it, that's the whole thing β no cap, she's the lowkey useful friend who just quietly handles it π
β¨ ATTRIBUTES β¨
π custom_types
Custom user-defined MIME types β the ones you add in with add_type. your own little collection, your own little slay πΈ
π default
The default MIME type defined by MIME::Types, and it's set to: application/data. so if nobody says otherwise, that's the one showing up to the party π
π METHODS π
π reset_default
Deprecated, bestie β use reset_to_default instead. I'm not mad I'm just disappointed, move on π
π reset_to_default
This method resets mime_type to the default type. fresh start, clean slate, rebrand π
π add_type
This method adds the new MIME type. new type just dropped β¨
π add_alias
The add_alias sets a MIME type alias. nickname acquired π«Ά
π for_name
The method for_name gets MIME type for an alias. you give the alias, it gives the type. transactional, iconic π
π for_file
This method gets MIME type for a file based on extension. yes based on the extension, she's not out here reading your file's soul, just the ending π
π name_or_type
This method sets the customized MIME name or default MIME type into a content type. so like, whatever you hand her becomes a content type. chef's kiss π
π AUTHOR π
Dancer Core Developers β the collective. the committee. the girlies π§
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2026 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.
free software fr fr, go wild, just keep the same terms as Perl 5 itself π«Ά
and that's the page bestie!! this beauty shipped as perl v5.42.3, dated 2026-09-20, and it lives in the User Contributed Perl Documentation corner of the world π mwah, go set some MIME types, you're doing amazing β¨ππ
π¦ where this page comes from
- fedora 44: perl-Dancer2 2.2.1-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms