in reply to Export again
All the solutions proposed are excellent. The symbol table manipulation you proposed failed because you assigned the scalar $gettimeofday from Time::HiRes (which probably is not defined anyway). Instead of
*gettimeofday = \$Time::HiRes::gettimeofday;you have to use "&" to get the subroutine reference:
*gettimeofday = \&Time::HiRes::gettimeofday;Alternatively, you could assign the entire symbol table entry using "*":
*gettimeofday = \*Time::HiRes::gettimeofday;Then not only would your module get Time::HiRes's "gettimeofday" subroutine, but also any other Perl things (array, hash, etc) with the name "gettimeofday".
|
|---|