Badger::Debug

package Your::Forager;
use base 'Badger::Base';

our $MESSAGES = {
    foraging => 'Foraging in the %s for %s',
};

sub forage {
    my ($self, $where, $what) = @_;
    $self->debug_msg( foraging => $where, $what );
    # ... do some foraging...
}

Calling the Method

$forager->forage('forest', 'nuts and berries');

Debugging Output (stderr)

[Your::Forager line 6] Foraging in the forest for nuts and berries
Thus Spake Andy:

You can also use the debug_msg() method in conjunction with the $MESSAGES facility.