File: README.md

package info (click to toggle)
libdata-messagepack-stream-perl 1.05%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 192 kB
  • sloc: perl: 26; makefile: 3
file content (65 lines) | stat: -rw-r--r-- 1,531 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
[![Build Status](https://travis-ci.org/typester/Data-MessagePack-Stream.svg?branch=master)](https://travis-ci.org/typester/Data-MessagePack-Stream)
# NAME

Data::MessagePack::Stream - yet another messagepack streaming deserializer

# SYNOPSIS

    use Data::Dumper;
    my $unpacker = Data::MessagePack::Stream->new;

    while (read($fh, my $buf, 1024)) {
        $unpacker->feed($buf);

        while ($unpacker->next) {
            print Dumper($unpacker->data);
        }
    }

# DESCRIPTION

Data::MessagePack::Stream is streaming deserializer for MessagePack.

This module is alternate for [Data::MessagePack::Unpacker](https://metacpan.org/pod/Data%3A%3AMessagePack%3A%3AUnpacker).
Unlike original unpacker, this module support internal buffer and it's possible to handle streaming data correctly.

# METHODS

## new

    my $unpacker = Data::MessagePack::Stream->new;

Create new stream unpacker.

## feed($data)

    $unpacker->feed($data);

Push `$data` into unpacker's internal buffer.

## next

    my $bool = $unpacker->next;

If parsable MessagePack packet is fed, return true.
You can get that parsed data by `data` method described below.

## data

    my $data = $unpacker->data;

Return parsed perl object.

# AUTHOR

Daisuke Murase <typester@cpan.org>

# COPYRIGHT AND LICENSE

Copyright (c) 2012 by KAYAC Inc.

This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the
LICENSE file included with this module.