Adding Functions during Runtime
Published on 30 Nov 2007Tags #Perl
The following code chunk demonstrates how to add functions to the current namespace during runtime:
*test = sub {
print 'blarg' . "n";
};
NOTE: When using this code inside objects the function is available globally.
See also: Adding methods and Dynamic code considerations
Feedback is always welcome! If you'd like to get in touch with me concerning the contents of this article, please use Twitter.