@@ -1,3 +1,4 @@
+# This Build.PL for AnyEvent-Twitter-Stream was generated by Dist::Zilla::Plugin::ModuleBuildTiny 0.006.
use 5.008001;
-use Module::Build::Tiny 0.023;
+use Module::Build::Tiny 0.035;
Build_PL();
@@ -1,5 +1,8 @@
Revision history for Perl extension AnyEvent::Twitter::Stream
+0.27 2014-04-18 14:08:51 JST
+ - Fixed Chunked handling for long JSON strings (dexterbt1)
+
0.26 2013-06-10 14:52:56 PDT
- Fix dependencies
@@ -1,4 +1,4 @@
-This software is copyright (c) 2013 by Tatsuhiko Miyagawa <miyagawa@bulknews.net>.
+This software is copyright (c) 2014 by Tatsuhiko Miyagawa <miyagawa@bulknews.net>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
-This software is Copyright (c) 2013 by Tatsuhiko Miyagawa <miyagawa@bulknews.net>.
+This software is Copyright (c) 2014 by Tatsuhiko Miyagawa <miyagawa@bulknews.net>.
This is free software, licensed under:
@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -272,7 +272,7 @@ That's all there is to it!
--- The Artistic License 1.0 ---
-This software is Copyright (c) 2013 by Tatsuhiko Miyagawa <miyagawa@bulknews.net>.
+This software is Copyright (c) 2014 by Tatsuhiko Miyagawa <miyagawa@bulknews.net>.
This is free software, licensed under:
@@ -1,3 +1,4 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.015.
Build.PL
Changes
LICENSE
@@ -4,7 +4,7 @@
"Tatsuhiko Miyagawa <miyagawa@bulknews.net>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Milla version v1.0.2, Dist::Zilla version 4.300034, CPAN::Meta::Converter version 2.131560",
+ "generated_by" : "Dist::Milla version v1.0.4, Dist::Zilla version 5.015, CPAN::Meta::Converter version 2.140640",
"license" : [
"perl_5"
],
@@ -26,7 +26,7 @@
"prereqs" : {
"configure" : {
"requires" : {
- "Module::Build::Tiny" : "0.023"
+ "Module::Build::Tiny" : "0.035"
}
},
"develop" : {
@@ -63,10 +63,11 @@
"web" : "https://github.com/miyagawa/AnyEvent-Twitter-Stream"
}
},
- "version" : "0.26",
+ "version" : "0.27",
"x_contributors" : [
"Chris Prather <chris@prather.org>",
"Daisuke Murase <typester@cpan.org>",
+ "Dexter Tad-y <dtady@cpan.org>",
"Marc Mims <marc@questright.com>",
"Mark Norman Francis <norm@cackhanded.net>",
"Masayuki Matsuki <y.songmu@gmail.com>",
@@ -3,17 +3,17 @@ abstract: 'Receive Twitter streaming API in an event loop'
author:
- 'Tatsuhiko Miyagawa <miyagawa@bulknews.net>'
build_requires:
- Test::More: 0
- Test::Requires: 0
- Test::TCP: 0
+ Test::More: '0'
+ Test::Requires: '0'
+ Test::TCP: '0'
configure_requires:
- Module::Build::Tiny: 0.023
+ Module::Build::Tiny: '0.035'
dynamic_config: 0
-generated_by: 'Dist::Milla version v1.0.2, Dist::Zilla version 4.300034, CPAN::Meta::Converter version 2.131560'
+generated_by: 'Dist::Milla version v1.0.4, Dist::Zilla version 5.015, CPAN::Meta::Converter version 2.140640'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: AnyEvent-Twitter-Stream
no_index:
directory:
@@ -24,19 +24,20 @@ no_index:
- eg
- examples
requires:
- AnyEvent: 0
- AnyEvent::HTTP: 2.0
- JSON: 2.0
- URI: 0
- perl: 5.008001
+ AnyEvent: '0'
+ AnyEvent::HTTP: '2.0'
+ JSON: '2.0'
+ URI: '0'
+ perl: '5.008001'
resources:
bugtracker: https://github.com/miyagawa/AnyEvent-Twitter-Stream/issues
homepage: https://github.com/miyagawa/AnyEvent-Twitter-Stream
repository: https://github.com/miyagawa/AnyEvent-Twitter-Stream.git
-version: 0.26
+version: '0.27'
x_contributors:
- 'Chris Prather <chris@prather.org>'
- 'Daisuke Murase <typester@cpan.org>'
+ - 'Dexter Tad-y <dtady@cpan.org>'
- 'Marc Mims <marc@questright.com>'
- 'Mark Norman Francis <norm@cackhanded.net>'
- 'Masayuki Matsuki <y.songmu@gmail.com>'
@@ -10,7 +10,7 @@ SYNOPSIS
username => $user,
password => $password,
method => "filter", # "firehose" for everything, "sample" for sample timeline
- follow => join(",", @following_ids),
+ follow => join(",", @following_ids), # numeric IDs
on_tweet => sub {
my $tweet = shift;
warn "$tweet->{user}{screen_name}: $tweet->{text}\n";
@@ -78,6 +78,9 @@ METHODS
With this method you can specify what you want to filter amongst
track, follow and locations.
+ See <https://dev.twitter.com/docs/api/1.1/post/statuses/filter>
+ for the details of the parameters.
+
api_url
Pass this to override the default URL for the API endpoint.
@@ -2,7 +2,7 @@ package AnyEvent::Twitter::Stream;
use strict;
use 5.008_001;
-our $VERSION = '0.26';
+our $VERSION = '0.27';
use AnyEvent;
use AnyEvent::HTTP;
@@ -168,31 +168,38 @@ sub new {
return unless $handle;
my $input;
- my $chunk_reader = sub {
+ my $chunk_reader;
+ $chunk_reader = sub {
my ($handle, $line) = @_;
$line =~ /^([0-9a-fA-F]+)/ or die 'bad chunk (incorrect length)';
my $len = hex $1;
-
- $handle->push_read(chunk => $len, sub {
- my ($handle, $chunk) = @_;
- $handle->push_read(line => sub { length $_[1] and die 'bad chunk (missing last empty line)'; });
-
+ my $chunk_part_reader;
+ $chunk_part_reader = sub {
+ my ($handle, $chunk_raw) = @_;
+ my $chunk = $chunk_raw;
+ $chunk =~ s/\r\n$//;
+ $input .= $chunk;
unless ($headers->{'content-encoding'}) {
- $on_json_message->($chunk);
+ while ($input =~ s/^(.*?)\r\n//) {
+ my ($json_raw) = $1;
+ $on_json_message->($json_raw);
+ }
} elsif ($headers->{'content-encoding'} =~ 'deflate|gzip') {
- $input .= $chunk;
my ($message);
do {
- $_zstatus = $zlib->inflate(\$input, \$message);
- return unless $_zstatus == Z_OK || $_zstatus == Z_BUF_ERROR;
+ $_zstatus = $zlib->inflate(\$input, \$message);
+ return unless $_zstatus == Z_OK || $_zstatus == Z_BUF_ERROR;
} while ( $_zstatus == Z_OK && length $input );
$on_json_message->($message);
} else {
- die "Don't know how to decode $headers->{'content-encoding'}"
+ die "Don't know how to decode $headers->{'content-encoding'}"
}
- });
+ $handle->push_read(line => $chunk_reader);
+ }; # chunk_part_reader
+ $handle->push_read(chunk => $len + 2, $chunk_part_reader);
};
+
my $line_reader = sub {
my ($handle, $line) = @_;
@@ -256,7 +263,7 @@ AnyEvent::Twitter::Stream - Receive Twitter streaming API in an event loop
username => $user,
password => $password,
method => "filter", # "firehose" for everything, "sample" for sample timeline
- follow => join(",", @following_ids),
+ follow => join(",", @following_ids), # numeric IDs
on_tweet => sub {
my $tweet = shift;
warn "$tweet->{user}{screen_name}: $tweet->{text}\n";
@@ -335,6 +342,8 @@ To use this method, you need to use the OAuth mechanism.
With this method you can specify what you want to filter amongst B<track>, B<follow> and B<locations>.
+See L<https://dev.twitter.com/docs/api/1.1/post/statuses/filter> for the details of the parameters.
+
=back
=item B<api_url>
@@ -7,9 +7,8 @@ BEGIN {
}
}
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use Test::More;
-
-eval "use Test::Pod 1.41";
-plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
+use Test::Pod 1.41;
all_pod_files_ok();