Text::...::Debug(3pm)

πŸ“¦
version 2.23 Β· 3 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Text::...::Debug β€” the vibe check page πŸ’–

okay bestie, so this is Text::MicroMason::Debug, and no cap, it's the little mixin that spills all the tea about what your templates are doing, by way of warn. It lives in the User Contributed Perl Documentation corner of the manual world. Let's get into it 🫢


✨ NAME ✨

Text::MicroMason::Debug β€” it hands the dev (that's you, main character πŸ‘‘) all the info via warn.


🌸 SYNOPSIS 🌸

okay so real talk: you do not use this class directly, bestie. Not the move. Instead you pass its name in so it gets mixed in πŸ’…

  use Text::MicroMason;
  my $mason = Text::MicroMason->new( -Debug );

Then you just use the standard compile and execute methods to parse and evaluate templates, like the icon you are:

  print $mason->compile( text=>$template )->( @%args );
  print $mason->execute( text=>$template, @args );

And boom, you'll see lots of warning output on STDERR β€” it's giving commentary track, honestly:

  MicroMason Debug create: Text::MicroMason::Base::AUTO::Debug...
  MicroMason Debug source: q(Hello <% $noun %>!)
  MicroMason Debug lex: text, q(Hello ), expr, q( $noun ), text, q(!)
  MicroMason Debug eval: sub { my @OUT; my $_out = sub { push ...

πŸ¦‹ DESCRIPTION πŸ¦‹

This package provides numerous messages via warn, for developer use when you're debugging templates built with Text::MicroMason. It's basically your template's group chat receipts. πŸ“

⭐ Supported Attributes ⭐

  • debug β€” this activates debugging messages for many methods. By default it logs everything. Yeah, all of it, the whole feed πŸ™ˆ

You can set it to 0 or 1 to log nothing or everything. Simple as.

Or β€” and this is the slay part β€” set it to a hash reference containing values for the steps you're actually interested in, so you only log those items:

  debug => { source => 1, eval => 1 }

And you can also selectively suppress some warnings, for when you want the general noise but not those specific ones:

  debug => { default => 1, source => 0, eval => 0 }

πŸ’œ Private Methods πŸ’œ

  • debug_msg β€” this is the one that gets called to provide a debugging message for developer reference. And listen: no output is produced unless the object's 'debug' flag is true. So if you're seeing nothing, that flag is the culprit, not you. 🧚

πŸ‘‘ SEE ALSO πŸ‘‘

  • For an overview of this templating framework, see Text::MicroMason.
  • This is a mixin class intended for use with Text::MicroMason::Base.
  • For distribution, installation, support, copyright and license information, see Text::MicroMason::Docs::ReadMe.

and that's the whole page, bestie πŸ’€ This one shipped with perl v5.36.0, dated 2023-08-10 β€” so if you're reading this from the future, hey, the lore still holds. Go forth and debug, you gorgeous genius πŸŽ€βœ¨πŸ«Ά

πŸ“¦ where this page comes from