Peter Rabbitson wrote:
Hello list,
Is there a clean and elegant way to make a subroutine available to all namespaces/packages? Something like the UNIVERSAL class for objects, but for non-OO environment. I need to embed a logging facility into a multimodule project, so I want to have a certain function (say log_msg() ) to be available anywhre in the program, without importing it in each and every module.

Then don;t EXPORT it and call it with the entire name:


package Local::MyUniversal;

sub log_msg {

}

in your scripts and modules

use local::MyUniversal;


Local::MyUniversal::log_msg("where's the beef?");

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to