Questions tagged [anyevent]

AnyEvent is a Perl framework for event-based programming

AnyEvent(similar to POE and Twisted) is a framework for event-based programming. It comes with a number of different implementations while maintaining the same API(unless otherwise mentioned in the documentation). The current implementations are POE,Perl(pure Perl),IOAsync,EV,Event,EventLib,Cocoa,FLTK,Glib,Irssi,Qt,Tk.

It can be used for building high-performance applications that scale well. At the same time, synchronization primitives are available(condition variables), polling(via poll or epoll), running periodic tasks, inotify support(via AnyEvent::Filesys::Notify), database support(via AnyEvent::DBI), forking(via AnyEvent::Fork) and it comes with a built-in non-blocking HTTP client(AnyEvent::HTTP). There are many modules that extend AnyEvent's functionality which can be found on CPAN.

85 questions
3
votes
1 answer

Can I use a AnyEvent->timer() in a AnyEvent::Fork ?

Let's say I work with a number N of account object. I would like to create for N Account, several forks, and independently include an event AnyEvent-> timer (). here is what my code looks like: for my $num_account (1..2) { my $fork_1 =…
3
votes
1 answer

twiggy plack anyevent how to handle requests while the main loop is blocking?

I'm very new to Plack, Twiggy and AnyEvent and having a problem. I have client facing application servers that fire requests to a backend game server. The game servers do a couple of things. 1. they do things to objects when a request arrives from…
mark
  • 1,769
  • 3
  • 19
  • 38
3
votes
2 answers

AnyEvent::HTTP basic example not working

AnyEvent::HTTP Tried on Debian and Centos, both with perl 5.10 Not a sound after perl -Mstrict -we 'use AnyEvent::HTTP; http_get "http://www.nethype.de/", sub { print $_[1] }; sleep 20' Is there something fundamentally broken with module, or do I…
mpapec
  • 50,217
  • 8
  • 67
  • 127
3
votes
2 answers

Simple ZeroMQ Perl (AnyEvent) HelloWorld program hangs after two loop iterations

I slightly modified the helloworld server program (hwserver.pl) from the ZeroMQ guide, to implement it with AnyEvent. Yet after two iterations of REQ/REP, the program hangs. Can someone figure out why? Here's the server: #!/usr/bin/perl -w use…
alexk
  • 1,488
  • 1
  • 12
  • 17
2
votes
1 answer

Unable to read client's message using AnyEvent::Socket and tcp_connect (to a UNIX domain socket)

Running the following server and client scripts: Server (updated): #!/usr/bin/perl use strict; use warnings; use feature 'say' ; use AnyEvent ; use AnyEvent::Socket ; use AnyEvent::Handle ; tcp_server 'unix/', '/tmp/.mysocket', sub { my ( $fh,…
Hannibal
  • 445
  • 4
  • 13
2
votes
1 answer

Convert deprecated Perl's Net::IRC codes to AnyEvent::IRC::Client inquiry

Since the Perl's Net::IRC library's been deprecated, I need to convert some old code that uses it over to the newer AnyEvent::IRC::Client. The problem is that the MetaCPAN's AnyEvent docs. don't show any equivalence to the IRC numeric event codes…
santa100
  • 255
  • 1
  • 5
2
votes
1 answer

Monitoring and reading new lines in a file?

The program uses the AnyEvent event loop. The program should read new lines that sometimes (rarely) appear in a text file on the local file system. As I understood, AnyEvent::io can not be used. What can I advise to read new lines from a file?
Dmitriy
  • 463
  • 1
  • 5
  • 12
2
votes
0 answers

AnyEvent stopped attempting to make connections after certain point

Created a script to test against a server (it's capable of over 100K concurrent TCP sockets). Affter it reaches 65536, the client stopped attempting to set up connections. Wonder why. use AnyEvent; use EV; use AnyEvent::Handle; use…
packetie
  • 4,839
  • 8
  • 37
  • 72
2
votes
0 answers

How stop reading data in AnyEvent

I've been doing some proxy script using Perl's AnyEvent. Agent<->Proxy-Server<->client My program acts as the proxy server in this setup. In AnyEvent::Handle, How can I stop reading data from the agent and resume after client gets the data?. Part…
Prosessor
  • 21
  • 1
2
votes
1 answer

AnyEvent::STOMP::Client + AnyEvent::ForkManger = Intermittent Error

I'm trying to write a process that listens to ActiveMQ and based on the message, goes out and grabs data from a webservice, does some processing and then puts the process data to another webservice. (REST/JSON) The module below works fine until one…
Todd
  • 698
  • 6
  • 19
2
votes
1 answer

How to force AnyEvent to use EV

I have been using AnyEvent for a while and EV is installed in my computer. I have the understanding that if EV is installed AnyEvent will try to use it as first resort, but I keep seeing people doing this: use EV; use AnyEvent;
user2348668
  • 768
  • 7
  • 19
2
votes
2 answers

Measure individual time taken using perl AnyEvent

I have a requirement to fetch many http urls and I use AnyEvent::HTTP to do this For every URL I need to measure the time taken how can I do this ? My code (stripped down) is here #!/usr/bin/perl …
Ram
  • 1,155
  • 13
  • 34
2
votes
2 answers

Pass a class subroutine as a callback

I am using a module that takes callbacks (AnyEvent::Socket). I am trying to pass a class subroutine as a callback but nothing is working example: tcp_server undef, $self->port,\$self->handle_connection It just does not work, it complaints about…
user2348668
  • 768
  • 7
  • 19
2
votes
1 answer

How to call event loop from callback?

That is, let the event loop process the events currently in queue. In VBA the call is named DoEvents. I want to do this in Perl. Preferably to do this in AnyEvent, because I have a script written with it. But I couldn't find any function like that…
2
votes
0 answers

How can I enable AnyEvent::XMPP to connect to a server using namespace prefixes in the XML stream?

The XMPP server I am attempting to connect to has namespace prefixes like the following (zdef-#########):
Pollywog
  • 31
  • 5