1Test2::Harness::Util::FUisleer::CSotnrteraimb(u3t)ed PerTlesDto2c:u:mHeanrtnaetsiso:n:Util::File::Stream(3)
2
3
4

NAME

6       Test2::Harness::Util::File::Stream - Utility class for manipulating a
7       file that serves as an output stream.
8

DESCRIPTION

10       Subclass of Test2::Harness::File that streams the contents of a file,
11       even if the file is still being written.
12

SYNOPSIS

14           use Test2::Harness::Util::File::Stream;
15
16           my $stream = Test2::Harness::Util::File::Stream->new(name => 'path/to/file');
17
18           # Read some lines
19           my @lines = $stream->poll;
20
21           ...
22
23           # Read more lines, if any.
24           push @lines => $stream->poll;
25

ATTRIBUTES

27       See Test2::Harness::File for additional attributes.
28
29       These can be passed in as construction arguments if desired.
30
31       $bool = $stream->use_write_lock
32       $stream->use_write_lock($bool)
33           Lock the file for every "write()" operation.
34
35       $bool = $stream->tail
36           Start near the end of the file and only poll for updates appended
37           to it.
38

METHODS

40       See Test2::Harness::File for additional methods.
41
42       @lines = $stream->read()
43           Read all lines from the beginning. Every time it is called it
44           returns ALL lines.
45
46       @lines = $stream->poll()
47       @lines = $stream->poll(max => $int)
48           Poll for lines. This is an iterator, it should not return the same
49           line more than once, you can call it multiple times to get any
50           additional lines that have been added since the last poll.
51
52       $stream->write(@content)
53           Append @content to the file.
54

SOURCE

56       The source code repository for Test2-Harness can be found at
57       http://github.com/Test-More/Test2-Harness/.
58

MAINTAINERS

60       Chad Granum <exodist@cpan.org>
61

AUTHORS

63       Chad Granum <exodist@cpan.org>
64
66       Copyright 2020 Chad Granum <exodist7@gmail.com>.
67
68       This program is free software; you can redistribute it and/or modify it
69       under the same terms as Perl itself.
70
71       See http://dev.perl.org/licenses/
72
73
74
75perl v5.32.0                      2020-07-T2e8st2::Harness::Util::File::Stream(3)
Impressum