[Chicago-talk] Debugging Filter::Simple?

Greg Fast gdf at speakeasy.net
Tue Mar 15 08:38:43 PST 2005


Has anyone used Filter::Simple?  Anyone know how to get it to dump out
the transformed version of what it's filtered?

I've got a little hack that I've used on and off for debugging for a
few years, in a file called DEBUG.pm:

  package DEBUG;
  use Filter::Simple;
  FILTER {
    s/^\s*\#DEBUG //gm;
  }
  1;

Which I use in stuff like this:

  package Bleh::Moo::Horkage;
  use DEBUG;

  sub complex_mess {
    # ...
    #DEBUG print "Slow complex data dump: ", $data->to_human, "\n";
  }

If I comment out the "use DEBUG", the debug lines are just comments,
but if it's uncommented, those lines get executed.

Except that all of a sudden it's choking on something, and breaking
the code in a module:

  Global symbol "$eval_str" requires explicit package name at lib/Grinder/VirtualClass.pm line 13.
  (etc...)

Since I don't know what the filtered .pm looks like, these messages
are... unhelpful.

--
Greg Fast
http://cken.chi.groogroo.com/~gdf/


More information about the Chicago-talk mailing list