--- Geoffrey Young <[EMAIL PROTECTED]> wrote:

> hi all...
> 
> from the docs Hook::Lexwrap just seems to be way too much for testing.

Hi Geoff,

What an interesting coincidence.  I recently came to the same conclusion, so I uploaded
Sub::Override to the CPAN a few days ago.  
http://search.cpan.org/~ovid/Sub-Override-0.03/

Synopsis:

  my $override = Sub::Override->new( foo => sub { 'overridden sub' } );
  # use the new sub
  $override->restore;
  # original sub available

You can override multiple subs:

  $override->replace('Some::sub1', sub { 'new data1' })
           ->replace('Some::sub2', sub { 'new data2' })
           ->replace('Some::sub3', sub { 'new data3' });

And you can let the overriding 'fall out of scope':

  {
    my $override = Sub::Override->new(some_sub => \&new_sub);
    # new some_sub behavior
  }
  # old some_sub behavior

It has a few other features, too.  If anyone likes it and has any feature requests, 
please let me
know.

Cheers,
Ovid

=====
Silence is Evil            http://users.easystreet.com/ovid/philosophy/indexdecency.htm
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/

Reply via email to