Test2::Harness::Util::File::JSONL - Utility class for a JSONL file (stream)
Contents
Copyright
Copyright 2020 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl
itself.
See http://dev.perl.org/licenses/
perl v5.40.1 2025-05-23 Test2::Harness::Util::File::JSONL(3pm)
Description
Subclass of Test2::Harness::Util::File and Test2::Harness::Util::File::Stream which automatically handles
encoding/decoding JSONL data.
Maintainers
Chad Granum <exodist@cpan.org>
Name
Test2::Harness::Util::File::JSONL - Utility class for a JSONL file (stream)
See Also
See the base classes Test2::Harness::Util::File and Test2::Harness::Util::File::Stream for methods.
Source
The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/.
Synopsis
use Test2::Harness::Util::File::JSONL;
my $jsonl = Test2::Harness::Util::File::JSONL->new(name => '/path/to/file.jsonl');
while (1) {
my @items = $jsonl->poll(max => 1000) or last;
for my $item (@items) {
... handle $item ...
}
}
or
use Test2::Harness::Util::File::JSONL;
my $jsonl = Test2::Harness::Util::File::JSONL->new(name => '/path/to/file.jsonl');
$jsonl->write({my => 'item', ... });
...
