Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

POE::Wheel::FollowTail with a changing filename to tail

by Random_Walk (Prior)
on Feb 25, 2008 at 12:47 UTC ( #669991=perlquestion: print w/replies, xml ) Need Help??
Random_Walk has asked for the wisdom of the Perl Monks concerning the following question:

Greetings dear monks,

I am using POE::Wheel::FollowTail to parse a number of log files written to one central logging server. Unfortunately these files include the epoch time in the file name and a rolled over at midnight. The name of the new file should be predictable, it is a base name plus the epoch seconds at midnight.

I plan to act on the ResetEvent that should be generated when the file is removed. Then I want to change FollowTails' internal file name with something like ...

sub reset_handler { my ($heap, $wheel_id) = @_[HEAP, ARG0 ]; # I kept a ref to wheel under its ID in the heap my $wheel = $heap->{wheel}->{"wheel_$id"}; my $SELF_FILENAME = $POE::Wheel::FollowTail::SELF_FILENAME(); my $new_file = derive_new_name(); $wheel->[$SELF_FILENAME] = $new_file; return; }
when FollowTail tries to re-open the file it should pick up the new one. I think it should work with perhaps a little minor tweaking but is it sane to hook into internal details of FollowTail like this or is there a more sensible way to do this ?

Thanks for taking the time,
R.

Pereant, qui ante nos nostra dixerunt!

Replies are listed 'Best First'.
Re: POE::Wheel::FollowTail with a changing filename to tail
by Anonymous Monk on Feb 25, 2008 at 13:51 UTC
    subclass

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://669991]
Approved by Joost
Front-paged by Corion
help
Chatterbox?
[james28909]: ill be back with a solution eventually
[stevieb]: it's a reminder to re-inforce it :P
[atcroft]: james28909: That particular questions was a bit of trick, actually (depending on the country you are in). More interesting is, if you are trying to subtract from an epoch time, for instance, you might have to consider when/if DST occurs for a location,
[atcroft]: because you may have to adjust the number of seconds you change from an epoch from 86400 (not to mention leap seconds)....
[atcroft]: james28909: Although if your program is using a database, you might be able to "pass the buck" to the database and ask it to do the date change for you....

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2017-04-29 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (531 votes). Check out past polls.