Logging with Log::StdLog from within a package
- From: Jerry Krinock <jerry@xxxxxxxx>
- Date: Wed, 30 Jul 2008 22:35:21 -0700 (PDT)
Today, I separated out a file of functions into a separate package:
package MyPackage ;
Instead of 'use', I 'require and call the functions using
MyPackage::aFunction() ;
It works fine except for my Log::Stdlog calls such as:
print {*STDLOG} info => "Hello\n" ;
None of any such calls from inside package functions print to my log
any more. They "just don't work".
A confession: I've come a long way with Perl, but one thing still
beyond my comprehension is the 'tie' function with its "enchanted"
variable that seems to be the magic behind {*STDLOG}. What does the
asterisk do?
How can I make my logs work inside my package?
Thanks very much,
Jerry Krinock
.
Relevant Pages
- Re: packages
... use separate package for each module ... i.e. IIRC, this is frequently the reason for Boost libraries having a "detail" namespace nested within the subsystem namespace. ... But there is more to it than that for C++, especially when on stops to think about all of the ways that function overloading, built-in vs user-defined conversions, public/protected/private inheritance, public/protected/private members, ADL, template argument deduction, whether or not a name is dependent on a template parameter, especially for base classes with a dependent template parameter (e.g., ... (comp.lang.lisp) - Re: [SLE] Postfix as a POP3 Server
... > A seperate package within Postfix? ... a separate package for your system just as mozilla is a separate ... (SuSE) - Re: Packages and ASDF
... One important concept to master is that ASDF and packages are completely ... A package is a namespace that is used to control the mapping from symbol ... because it is good programming practice to have a separate package for ... libraries present at the same time without having to worry about name ... (comp.lang.lisp) - Re: packages
... use separate package for each module ... frequently used, for example, in boost libraries. ... CONSUMER NOTICE: Because of the "uncertainty principle," it is ... (comp.lang.lisp) - Re: Logging with Log::StdLog from within a package
... None of any such calls from inside package functions print to my log ... so if you opened that STDLOG ... you can 'use Log::StdLog' within your package MyPackage ... Many live that deserve death. ... (comp.lang.perl.misc) |
|