Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

How would you extend MooseX::Log::Log4perl?

by metaperl (Curate)
on Jul 11, 2011 at 18:15 UTC ( [id://913742]=perlquestion: print w/replies, xml ) Need Help??

metaperl has asked for the wisdom of the Perl Monks concerning the following question:

MooseX::Log::Log4perl is a role. However, the role will not work with Log::Log4Perl being initialized. If moose roles could be subclassed, then you would simply create a local subclass of MooseX::Log::Log4perl and do your Log::Log4perl initiation there. But that is not possible. So somehow you need to do your local initialization and then also use this role, which seems a bit non-encapsulated.



The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development.

-- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"

  • Comment on How would you extend MooseX::Log::Log4perl?

Replies are listed 'Best First'.
Re: How would you extend MooseX::Log::Log4perl?
by spazm (Monk) on Jul 11, 2011 at 22:12 UTC
    I see what you're saying. The docs for MooseX::Log::Log4perl show a required BEGIN block to initialize Log::Log4perl.
    package MyApp; use Moose; use Log::Log4perl qw(:easy); with 'MooseX::Log::Log4perl'; BEGIN { Log::Log4perl->easy_init(); }
    Should one initialize Log::Log4perl and add the BEGIN block both in the application base class?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://913742]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found