Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Logging Singleton

by tobyink (Abbot)
on Feb 18, 2013 at 16:51 UTC ( #1019366=note: print w/replies, xml ) Need Help??


in reply to Logging Singleton

It's probably overkill. You could do this...

# SUBS my $log = Log->new(); sub do_this{ $log->log('Log This'); } sub do_that{ $log->log('Log That'); }

Or even this...

# SUBS my $log; sub do_this{ ($log||=Log->new)->log('Log This'); } sub do_that{ ($log||=Log->new)->log('Log That'); }
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019366]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2016-09-27 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (513 votes). Check out past polls.