Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: Parsing JSON out of an incremental stream

by Sec (Monk)
on Feb 18, 2019 at 17:40 UTC ( #1230122=note: print w/replies, xml ) Need Help??

in reply to Re: Parsing JSON out of an incremental stream
in thread Parsing JSON out of an incremental stream

For anyone following along.
$ua->add_handler( response_data => sub { my($response, $ua, $h, $data) = @_; eval { my $result = $json->incr_parse( $data ); if (defined $result){ print Dumper $result; }; }; if ($@){ print STDERR "Error: $@\n"; die }; 1; } );
is a pretty nice solution in my eyes.

The eval/catch is a bit of an eyesore, but LWP seems to silently eat all errors in handlers, and just not call them anymore which makes debugging quite difficult.

Also make sure you install JSON::XS - the "core" version of JSON::PP may decide to die on you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1230122]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2020-09-28 05:02 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (143 votes). Check out past polls.