So you're asking how get_logger works?
################################################## sub get_logger { # Get an instance (shortcut) ################################################## # get_logger() can be called in the following ways: # # (1) Log::Log4perl::get_logger() => () # (2) Log::Log4perl->get_logger() => ("Log::Log4perl") # (3) Log::Log4perl::get_logger($cat) => ($cat) # # (5) Log::Log4perl->get_logger($cat) => ("Log::Log4perl", $cat) # (6) L4pSubclass->get_logger($cat) => ("L4pSubclass", $cat) # Note that (4) L4pSubclass->get_logger() => ("L4pSubclass") # is indistinguishable from (3) and therefore can't be allowed. # Wrapper classes always have to specify the category explicitely. my $category; if(@_ == 0) { # 1 my $level = 0; do { $category = scalar caller($level++); } while exists $WRAPPERS_REGISTERED{ $category }; } elsif(@_ == 1) { # 2, 3 $category = $_[0]; my $level = 0; while(exists $WRAPPERS_REGISTERED{ $category }) { $category = scalar caller($level++); } } else { # 5, 6 $category = $_[1]; } # Delegate this to the logger module return Log::Log4perl::Logger->get_logger($category); }
It is a http://en.wikipedia.org/wiki/Singleton_pattern http://c2.com/cgi/wiki?PerlSingleton perldesignpatterns.com is-a-broken, but the book site is up

In reply to Re: Logger object access to different modules by Anonymous Monk
in thread Logger object access to different modules by perlpal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.