Loading ...
Sorry, an error occurred while loading the content.

Doubt on POE

Expand Messages
  • Shyam S
    Dear Group. I am very new to perl POE. I started to build an application. I need to call an some program using POE::Wheel::Run. I am here by sending the main
    Message 1 of 2 , Apr 24, 2007
    • 0 Attachment
      Dear Group.

      I am very new to perl POE. I started to build an application. I need to call
      an some program using POE::Wheel::Run.

      I am here by sending the main code snippet.

      POE::Component::Daemon->spawn(
      detach =>0,
      max_children=>1,
      logfile=>$logfile,
      verbose =>1
      );
      POE::Session->create(
      inline_states=>{
      _start=>\&start,

      got_child_stdout=>\&print_me,
      },
      );

      POE::Kernel->run();
      exit;


      sub start {
      use POE qw(Component::Server::TCP);
      my $PORT_NUMBER= 1122;
      POE::Component::Server::TCP->new(
      Port
      =>$PORT_NUMBER,

      ClientInput=>\&handle_input,
      );

      my ( $kernel, $heap ) = @_[ KERNEL, HEAP ];
      $heap->{program} = POE::Wheel::Run->new

      (

      Program => PROGRAM,

      StdoutEvent => "got_child_stdout",

      );
      }

      sub handle_input {
      my ($session,$heap,$input) =@_[SESSION,HEAP,ARG0];
      $heap->{client}->put($input);
      input_db($input);
      }

      sub PROGRAM { ... }
      sub print_me { ... }

      My main aim is to start some program with POE::Wheel::Run, but when I start
      to run the code I got a warning message.

      15394: SIGCHLD pid=15396 at
      /usr/local/share/perl/5.8.8/POE/Component/Daemon.pm line 684.
      15394: CHLD for 15396 child of someone else. at
      /usr/local/share/perl/5.8.8/POE/Component/Daemon.pm line 716.

      I am not sure what happened to my code. Later on while running the
      code.bysaving some values to database via input_db($input) the program
      get fails. I
      think that is because the POE::Session's heap and POR::Wheel::Run's heap
      data get some conflict.
      I am not sure. What wrong in between, either the the code or the program
      flow.

      Please help me.

      Thanks in Advance.

      Regards
      Shyam


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.