pprocacci has asked for the wisdom of the Perl Monks concerning the following question:
Firstly, thank you in advance for taking your time to read through my question.
The below `heavily modified` perl code works flawlessly without the call to retr_connected_users. Once I add that subroutine, perl gets hung on the `select` syscall *after* it's first interation through the code. I suspect it has something to do with the `some command` code, and I have tried variations like open/<>/close, but I cannot get past the first iteration.
My question is can AnyEvent effect the underlying file descriptors in a way that would cause this strange behavior and is there any way to read external data from pipes/file descriptors synchronously that perhaps I am just missing entirely?
Thanks for your time.use AnyEvent::XMPP::Ext::MUC; sub retr_connected_users { my @data = map { chomp; s/@.*//; $_ } (`some command`); return @data; } $muc->reg_cb( message => sub { my ( undef, undef, $msg ) = @_; my @inter = retr_connected_users(); foreach my $user(@inter){ AnyEvent::XMPP::IM::Message->new ( body => construct_body($msg->body, $fr +om), to => "$user\@" . HOST, type => "chat", )->send($conn); } }, );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: AnyEvent weirdness w/ open() and/or ``'s
by james2vegas (Chaplain) on Nov 02, 2013 at 17:06 UTC | |
by pprocacci (Initiate) on Nov 03, 2013 at 07:30 UTC |