carcassonne has asked for the wisdom of the Perl Monks concerning the following question:
Is there a way to use text data stored at the end of a Perl file in the context of a POE::Component::Logger, like this:
POE::Component::Logger->spawn(ConfigFile => 'log.conf')
Can the log configuration (text) found in log.conf be at the end of the same program file, past the __DATA__ (or __END__) statement and if so, how to tell POE::Component::Logger ?
Thanks.
UPDATE
It is possible to store the configuration file in the same file as the program file and then, to use it before launching the program.
The configuration has to go at the end of the program file, after the __DATA__ marker. Then when program starts, this data is written in /tmp and the program uses it.
setupConfig(); POE::Component::Logger->spawn(ConfigFile => '/tmp/mainlog.conf', Alias + => "mainlog"); sub setupConfig { local $/; my $config = <DATA>; open (LOGCONF, ">/tmp/mainlog.conf"); print LOGCONF $config; close LOGCONF; } __DATA__ dispatchers = file file.class = Log::Dispatch::File file.min_level = debug file.filename = "/tmp/mainlog.log" file.mode = append file.format = [%d] [%p] %m %n
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using data at the end of a program file
by MrFlibble (Initiate) on Feb 20, 2006 at 20:08 UTC | |
by carcassonne (Pilgrim) on Feb 21, 2006 at 14:46 UTC |