The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Devel::Trace::More - Like Devel::Trace but with more control

SYNOPSIS

  #!/usr/bin/perl -d:Trace::More

  use Devel::Trace::More qw{ filter_on };
  
  filter_on('blah');

  filter_on(qr/blah/);

  filter_on(sub { my ($p, $file, $line, $code) = @_; ... });

  # or

  $IS_INTERESTING = sub { my ($p, $file, $line, $code) = @_; ... };

DESCRIPTION

This module will print out every line of code as it executes when used under the perl debugger. By default all executed lines will print to STDERR. By calling filter_on with a code ref, regex ref, a scalar, or by setting $Devel::Trace::More::IS_INTERESTING directly then only those lines that are 'interesting' will be returned.

If filter_on is given a scalar or a regular expression reference then the file name of the code being executed or the line of code itself that matches the given patter will be printed. Passing in a code ref is the same as setting $IS_INTERESTING itself. Setting the filter this way will allow you to do more complicated things like filtering on just the module name or the line number of the code. $IS_INTERESTING can be changed in different places in the code if needed.

Caveat: Using regular epressions to filter what gets printed can cause unexected issues if the code being debugged relies on the regular expression global variables. Use with caution!

SEE ALSO

Devel::Trace

AUTHOR

mburns, <mburns.lungching@gmail.com>

Also code from Mark Jason Dominus

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Mike Burns

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.