GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Test2::Harness::Util::File::Stream(3) User Contributed Perl Documentation Test2::Harness::Util::File::Stream(3)

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

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

    use Test2::Harness::Util::File::Stream;

    my $stream = Test2::Harness::Util::File::Stream->new(name => 'path/to/file');

    # Read some lines
    my @lines = $stream->poll;

    ...

    # Read more lines, if any.
    push @lines => $stream->poll;

See Test2::Harness::File for additional attributes.

These can be passed in as construction arguments if desired.

$bool = $stream->use_write_lock
$stream->use_write_lock($bool)
Lock the file for every "write()" operation.
$bool = $stream->tail
Start near the end of the file and only poll for updates appended to it.

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

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

Chad Granum <exodist@cpan.org>

Chad Granum <exodist@cpan.org>

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/

2022-03-23 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.