in reply to using Sub::Install to override a module method that cannot be edited

Meditate on the following. Make sure you fully understand it before putting it into production code. Writing the explanatory comments is left as a mandatory exercise for the reader.
use strict; use warnings; use BaseModule qw( function1 function2 ); { no warnings 'overriden'; # I think that's the right one. my $old_function1 = \&function1; *function1 = sub { print "I am the overriden function\n"; $old_function1->( @_ ); }; }

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re: using Sub::Install to override a module method that cannot be edited
  • Download Code

Replies are listed 'Best First'.
Re^2: using Sub::Install to override a module method that cannot be edited
by unlinker (Monk) on Oct 07, 2007 at 04:44 UTC
    Thanks. Thats exactly what I want to do. I used Sub::Install to do it. And I was asking about the namespace calling semantics using that module. Thanks once again