Plack::...Refresh(3)

✨ Plack::...Refresh(3) ✨

okay bestie, so this is a page from the User Contributed Perl Documentation collection, and it's literally all about hot-swapping your Perl code mid-development without restarting anything. it's giving ✨live reload✨ energy. let's get into it πŸ’…


πŸŽ€ NAME πŸŽ€

Plack::Middleware::Refresh β€” refreshes all the modules in %INC, no cap 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

enable "Refresh", cooldown => 3;
$app;

look at that. two lines. iconic. πŸ’–


🌸 DESCRIPTION 🌸

so like, this is yet another approach to refreshing the modules sitting in %INC while you're in your development cycle, and the whole point is you don't need a forking process out there creeping on the filesystem watching for updates. nope. not here. πŸ™ˆ

instead, this middleware does the vibe check at request time: it compares the last refresh time against the current time, and if the difference is bigger than the cooldown seconds β€” which defaults to 10 β€” it calls Module::Refresh to reload every Perl module in %INC, but only if the files have actually been modified. lowkey genius honestly. ⭐

heads up bestie: this only reloads modules. it does not touch other files, like your templates. templates are not invited to this party πŸ“

it's also quite similar to what Rack::Reoader does. and if you're having issues with this reloading technique β€” like, say, when you have in-file templates that need to be recompiled, or Moose classes that have make_immutable β€” then go take a look at plackup's default -r option, or Plack::Loader::Shotgun instead. different tool, different vibe. πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

Tatsuhiko Miyagawa


🌈 SEE ALSO 🌈

  • Module::Refresh
  • Rack::Reloader

and that's the whole thing fr fr πŸ’œ written against perl v5.42.3, dated 2026-10-18. slay, go refresh something 🧚✨

πŸ“¦ where this page comes from