Hi,

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


In reply to Using data at the end of a program file by carcassonne

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.