in reply to Module Modification at Runtime

Not that I don't admire the evilness of the technique, but wouldn't it be easier to do something like this?

{ my $old = \&HTML::TableExtract::TableState::_taste_text; no warnings; *HTML::TableExtract::TableState::_taste_text = sub { local *HTML::TableExtract::TableState::_taste_text = $old; eval { shift->_taste_text(@_) }; print STDERR $@ if $@; die $@; }; };

This would only fall down if _taste_text depended on the state of the call stack (which you could get around with Sub::Uplevel), or does different things if not called as a method (which you could get around with called_as_method from Devel::Caller).

Replies are listed 'Best First'.
Re: Re: Module Modification at Runtime
by diotalevi (Canon) on Mar 26, 2003 at 13:17 UTC

    When I was debugging the code I was inserting my code into the middle. Its only for this write-up that I move the inserted code to the ends. So it was right after ->_skew and right before the tests regarding ->_terminus and ->_column. I've also done your wrapper code as well but at the time I didn't want to copy/paste code all over the place.