Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

"Backing up" a subroutine during runtime.

by dextius (Monk)
on Oct 21, 2008 at 16:30 UTC ( [id://718534] : perlmeditation . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
    # "Restore" the test function from it's "backup"
    $f->loader("*test_package::test_function = *test_package::new_test_fun
    +ction;");
    $f->test_function($counter++);
    
  2. or download this
    Original test_function! 0
    Original test_function! 1
    ...
    New output! 2
    Original test_function! 3
    Original test_function! 4