in reply to Add Code to functions in File
You could make your first file -- the one with code you "want to append" -- simply call the functions from the second file, then run some code afterwards. Presumably you have a third file calling the functions in question, so you would change that to use the first file instead of the second.
Maybe some example code will make more sense:
# File1.pm package File1; use File2; sub foo { File2::foo(@_); other(); code(); appended(); here(); } 1; # File2.pm package File2; sub foo { original(); code(); here(); } 1; # File 3 use File1; File1::foo(); # this will call File2::foo() behind the scenes
I have to wonder why you want to do this, though. It sounds like a sort of fishy request. Perhaps it would be a good idea to look into OO and use inheritance. Perhaps not. Without any details, we can't really give any good suggestions.
|
|---|