NAME
Text::JSON::Nibble - Nibble complete JSON objects from buffers
VERSION
Version 0.01
SYNOPSIS
Quick summary of what the module does.
Perhaps a little code snippet.
use warnings;
use strict;
use Text::JSON::Nibble;
use JSON::MaybeXS;
my $json = JSON->new;
my $item = Text::JSON::Nibble->new();
my $test = {
lol => {
a => [1,2,3],
b => "lol"
}
};
my $jsontext = $json->encode($test);
$jsontext = "$jsontext$jsontext";
print "jsontext: $jsontext\n";
my ($text,$offset) = $item->digest($jsontext);
print "Text: $text\n";
print "Offset: $offset\n";
# Beware the offset is a real offset so the first character is classed as 0, the literal length is 1 greater;
$jsontext = substr($jsontext,$offset+1);
print "new jsontext: $jsontext\n";
WARNING
This module should be used with caution, it will not handle 'badly formed' json well, its entire purpose was because I was experiencing segfaults with Cpanel::XS's decode_prefix when dealing with a streamnig socket buffer.
Use this only when needed.
SUBROUTINES/METHODS
new
Generate a new JSON Nibble object
digest
Digest the text that is fed and attempt to return a complete JSON object from it, returns two items the JSON object (in text form) and the offset in the buffer.
On a failure it will return "" and 0
AUTHOR
Paul G Webster, <daemon at cpan.org>
BUGS
Please report any bugs or feature requests to bug-text-json-nibble at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-JSON-Nibble. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Text::JSON::Nibble
You can also look for information at:
perl=over 4
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2017 Paul G Webster.
This program is released under the following license: BSD
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 163:
'=item' outside of any '=over'