in reply to Calling a method from class / subclass?

One addition:  $__PACKAGE__::mylog=Log::Log4perl->get_logger();

In this line of code; Log::Log4perl is a module of CPAN that generates the log files during runtime
Now as _PACKAGE_ contains the current package name then what mylog ($PACKAGE::mylog) is for. Is this for calling a variable named mylog from class in _PACKAGE_? Again, why Log::Log4perl is assigned to _PACKAGE_::mylog?? What does this mean?

Replies are listed 'Best First'.
Re^2: Calling a method from class / subclass?
by arkturuz (Curate) on Oct 05, 2007 at 09:10 UTC
    Quote: what mylog ($PACKAGE::mylog) is for

    To store the value you need variable name: that's $mylog. To store it in the current package, you can use $__PACKAGE__::mylog.

    Quote: Again, why Log::Log4perl is assigned to _PACKAGE_::mylog?? What does this mean?

    It could mean a number of things. One of them could be that author of the code wants a package global variable (variable that is global in the package defined) to be accessed from outside of the package.