Plack::MIME(3)

πŸ’– Plack::MIME(3) πŸ’–

okay so bestie, welcome to the perl manual pages, and specifically to Plack::MIME β€” aka the MIME type registry. yes she's a whole vibe, yes she's out here telling your server what a .png actually is. let's get into it πŸŽ€


✨ NAME ✨

Plack::MIME β€” MIME type registry. that's it, that's the whole name, she's simple and she's iconic 🫢


🌸 SYNOPSIS 🌸

look at her go, no cap:

use Plack::MIME;

my $mime = Plack::MIME->mime_type(".png"); # image/png

# register new type(s)
Plack::MIME->add_type(".foo" => "application/x-foo");

# Use MIME::Types as a fallback
use MIME::Types 'by_suffix';
Plack::MIME->set_fallback(sub { (by_suffix $_[0])[0] });

see how lowkey effortless that is?? mime_type(".png") and boom, image/png. add_type when you got your own lil extension you wanna register. set_fallback when you wanna bring in MIME::Types and by_suffix as your backup bestie. the (by_suffix $_[0])[0] is literally just grabbing the first thing back. main character energy fr fr πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so Plack::MIME is a simple MIME type registry for your Plack applications πŸ’… that's the whole job, she's not doing extra, she's not doing the most β€” she's doing exactly what you need.

and here's the tea: the selection of MIME types is based on Rack's Rack::Mime module. yep, the Ruby girlies ate and perl said "we're borrowing that, thanks bestie" πŸ“


🌈 SEE ALSO 🌈


no warnings, no bugs, no deprecated anything on this page β€” she's a clean girl, she's a good time, and honestly?? we love that for her πŸ™ˆ

and that's the whole page bestie, we're done πŸ’– this one came from the perl v5.42.3 docs, dated 2026-10-18, filed under Plack::MIME(3) β€” user contributed perl documentation, and wow did she serve 🌸 go forth and register your MIME types, mwah πŸ’…

πŸ“¦ where this page comes from