in reply to Devel::TrackSub - Subroutine wrappers for debugging

I like this one thanks :-)

I'd suggest one little addition:

Line 16: verbose => $arg{verbose} ? '' : "\n", ++ params => $arg{params} ? 1 : 0, Line 31: -- my( $direction, $pkg, $sym ) = @_; ++ my( $direction, $pkg, $sym , $start) = @_; Line 37: -- $pkg, $sym, $self->{verbose}, ++ $pkg, $sym, ++ ( $start && $self->{params} ? "( '".join( "', '", @_[0..$#_-1] +)."')" : ()), ++ $self->{verbose}, Line 85: -- pre => $self->_gen_wrapper( $self->{pre}, $pkg, $sym, ), -- post => $self->_gen_wrapper( $self->{post}, $pkg, $sym, ); ++ pre => $self->_gen_wrapper( $self->{pre}, $pkg, $sym, 1 ), ++ post => $self->_gen_wrapper( $self->{post}, $pkg, $sym, 0 +);
to allow printing the parameters to the procedure.

The code doesn't print data structures, if some of the parameters is a reference you'll see just SCALAR(xxxx), but I do not think that much info is needed. If you think otherwise you could use Data::Dumper to print them out:

Line 5: use Hook::LexWrap; ++ use Data::Dumper; Line 31: return sub{ ++ local $Data::Dumper::Indent = 0; ++ local $Data::Dumper::Terse = 1; Line 37: -- $pkg, $sym, $self->{verbose}, ++ $pkg, $sym, ++ ( $start && $self->{params} ? '( '.join( ", ", Dumper(@_[0..$# +_-1])).")" : ()), ++ $self->{verbose},

  Jenda

== Jenda@Krynicky.cz == http://Jenda.Krynicky.cz ==
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
      -- Rick Osborne, osborne@gateway.grumman.com

Replies are listed 'Best First'.
Re: Re: Devel::TrackSub - Subroutine wrappers for debugging
by particle (Vicar) on May 21, 2002 at 01:47 UTC
    ooh, i like that very much. thank you. i'll be sure to add your suggestions tomorrow.

    ~Particle *accelerates*