Perl Hobbyist and [perennial] [forum] [junkie.]

And I have a dog named [PoCo]. :p

A few projects I'm either involved in or annoy the people who are:

Contact Info

Things to Bug Rocco About

Random thoughts that come to me at work where I can't get on IRC, so I remember to ask later. (Or feel free to add answers here whoever you are reading this)

# Takes two args, a file to tail, and a reference to $_[HEAP]->{inputs}
  sub add_input_log {
    require POE::Component::FOO::Inputs::Log;
      "Invalid number of arguments to add_input_log (filename and input heap needed)."
      unless $#_ == 1;
    my $logfile = File::Spec->rel2abs(shift);
    my $iheap   = shift;
    $iheap->{logs} = {} unless exists $iheap->{logs};
    return if exists $iheap->{logs}->{$logfile};  #Do nothing if already tailing
    $iheap->{logs}->{$logfile} =
      POE::Component::FOO::Inputs::Log->tail($logfile);    #constructor
      inline_states => {
        _start  => \&input_log_init,
        foo_msg => \&foo_input,
        _stop   => \&log_stop,
      args => [$iheap->{logs}->{$logfile}->ID]
      ,    #Get session ID from PoCo::FOO::Inputs::Log

#               options => { trace => 1, debug => 1 },

  sub input_log_init {
    $_[KERNEL]->refcount_increment($_[SESSION]->ID, 'log')
      ;    #Oogly - don't really want to have to do this
    $_[KERNEL]->post($_[ARG0] => "report_event" => "foo_msg")
      ;    # Who's your daddy?  Child grabs $_[SENDER] from this

  sub foo_input {
    print "Yay!  I got Input!  YAY!\n"
      ; #Never gets reached from the child's postings, as this session _stops too soon.

  sub log_stop {
    print "_stop - PoCo::FOO (log input)\n";    #debugging junk