下記のコードがメインのイベントループである時、 on_error と on_eof の場合にイベントループが終了する。Twitter Streaming API との接続が切れた場合のエラー処理として、再接続を試みるにはどんな方法があるか思いつかない

my $cv = AE::cv;
my $streamer = AnyEvent::Twitter::Stream->new(
    username => $config->{username},
    password => $config->{password},
    method   => 'filter',
    track    => $word,
    on_tweet => sub { on_tweet_cb(@_); },
    on_error => sub { warn shift; $cv->send; },
    on_eof   => sub { $cv->send; },

AE::HTTP with Cookies


cookie_jar => $hash_ref

Passing this parameter enables (simplified) cookie-processing, loosely based on the original netscape specification.

The $hash_ref must be an (initially empty) hash reference which will get updated automatically. It is possible to save the cookie_jar to persistent storage with something like JSON or Storable, but this is not recommended, as expiry times are currently being ignored.

Note that this cookie implementation is not of very high quality, nor meant to be complete. If you want complete cookie management you have to do that on your own. cookie_jar is meant as a quick fix to get some cookie-using sites working. Cookies are a privacy disaster, do not use them unless required to.


LWP::UserAgent ライクに cookie_jar を使う方法はあるのだろうか。