=head1 NAME
JSON::Streaming::Reader - Read JSON strings in a streaming manner
=cut
package JSON::Streaming::Reader;
use strict;
use warnings;
use Carp;
use IO::Scalar;
use JSON::Streaming::Reader
or_stream($stream);
}
sub event_based {
my ($class, %callbacks) = @_;
my $fake_stream = JSON::Streaming::Reader::EventWrapper->new();
my $self = $class->for_stream($fake_stream);
$se
acter $char\n";
last;
}
};
if ($@) {
unless (ref($@) && $@ == JSON::Streaming::Reader::EventWrapper::UNDERRUN()) {
$self->{errored} = 1;
my
JSON::Streaming::Reader::TestUtil - Utility functions for the JSON::Streaming::Reader test suite
=head1 DESCRIPTION
This package contains some utility functions for use in the test suite for L<JSON
::Streaming::Reader>.
It's not useful outside of this context.
=cut
package JSON::Streaming::Reader::TestUtil;
use JSON::Streaming::Reader;
use Test::More;
use base qw(Exporter);
our @EXPORT = qw(
($name, $input, $expected_tokens) = @_;
my $jsonw = JSON::Streaming::Reader->for_string($input);
my @tokens = ();
while (my $token = $jsonw->get_token()) {
push @tokens, $token;
=head1 NAME
JSON::Streaming::Reader::EventWrapper - Internal utility package for JSON::Streaming::Reader
=cut
package JSON::Streaming::Reader::EventWrapper;
use strict;
use warnings;
# Make a du
$offset, "^\n";
}
1;
=head1 DESCRIPTION
This package is an internal implementation detail of L<JSON::Streaming::Reader>. It is used
to provide an API that looks like it blocks on top of a handle th
cking handle.
Instances of this class support enough of the C<IO::Handle> interface to satisfy L<JSON::Streaming::Reader>
and no more. In other words, they support only the C<read> method and assume