New method which can return mocked method.

I put simply method which can return reference of mocked method. 

I have problem when I want to now when program run some method, 
than first I mocked this method to some own function and when called this mocked method,
than I can call all code too, such as this example:

mock("CGI","header", sub {
   # ... doing something
   $code = mocked("CGI", "header");
   &$code();  # run old mocked method
});