Dancer...e::Trap(3pm)

πŸ’– Dancer::Logger::Capture::Trap β€” a lil home for your captured Dancer logs πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation corner of the manual world, section 3pm, and it's literally the cutest lil storage unit for your Dancer logs πŸŽ€

✨ NAME ✨

Dancer::Logger::Capture::Trap β€” a place to store captured Dancer logs πŸ’…

🌸 VERSION 🌸

version 1.3522

πŸ¦‹ SYNOPSIS πŸ¦‹

my $trap = Dancer::Logger::Capture::Trap->new;
$trap->store( $level, $message );
my $logs = $trap->read;

like, that's it. that's the whole vibe. πŸ’œ

✨ DESCRIPTION ✨

So basically this thing is a place to store and retrieve captured Dancer logs, and it's used by Dancer::Logger::Capture. think of it as the lil basket 🧺 that the logger drops stuff into so you can peek later. no cap.

πŸŽ€ Methods πŸŽ€

new

get yourself a fresh trap. brand new, empty, iconic. ✨

store

$trap->store($level, $message);

Stores a log $message and its $level. two lil arguments, one lil log, slotted right on in. 🫢

read

my $logs = $trap->read;

Returns the logs stored as an array ref and clears the storage. yes bestie, it empties the whole thing out β€” one read and the basket is empty again, so don't come crying later when your logs are gone 😭 it's giving "use it or lose it".

For example...

[{ level => "warning", message => "Danger! Warning! Dancer!" },
 { level => "error",   message => "You fail forever" }
];

look at that structure. the way it's an array ref of hash refs with level and message keys... we love a consistent shape. πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€

  • Dancer::Logger::Capture

πŸ’– AUTHOR πŸ’–

Dancer Core Developers β€” shoutout to the whole squad, they ate and left no crumbs. πŸ”₯

This software is copyright (c) 2010 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. πŸͺ (so yes, you can remix, share and pass it around, just keep the license energy the same, periodt.)


pssst. this one came to you via perl v5.40.1 and it's dated 2026-05-05. mwah πŸ’‹ thanks for reading, bestie β€” now go capture those logs! πŸŒˆπŸ“
πŸ“¦ where this page comes from