Zarathustra has asked for the wisdom of the Perl Monks concerning the following question:
lines in a BEGIN block? and the:setlogsock( 'unix' ); openlog( 'FooClass', 'pid', 'local6' );
in an END block? Something like:closelog()
Any help/advice is appreciated, thanks! UPDATE: When I attempt the above described pattern, I get an error message to the extent of:package FooClass; use strict; use warnings; use Sys::Syslog qw( :DEFAULT setlogsock ); BEGIN { setlogsock( 'unix' ); openlog( 'IPScan', 'pid', 'local6' ); } END { closelog() } sub new { my $invocant = shift; my $class = ref( $invocant ) || $invocant; my %args = @_; my $self = bless { %args }, $class; syslog( 'info', "blah blah blah" ); return $self; } sub foobar { my $self = shift; syslog( 'info', 'foobarred' ); # do stuff } 1;
where line 24 is the first attempt to use the syslog call, for instance, at:no connection to syslog available - _PATH_LOG not available in syslog.h at /path/to/FooClass.pm +line 24
... in the new() method.syslog( 'info', "blah blah blah" );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sys::Syslog in OOP Module
by Tanktalus (Canon) on Aug 24, 2006 at 03:59 UTC | |
by Zarathustra (Beadle) on Aug 24, 2006 at 04:14 UTC | |
by Zarathustra (Beadle) on Aug 24, 2006 at 04:38 UTC | |
by Zarathustra (Beadle) on Aug 24, 2006 at 04:53 UTC |