Crypt::Random::Source::Base::Handle(3pm)

Crypt::Random::Source::Base::Handle3pm

Io::handle based random data sources

Usage

    use Moo;
    extends qw(Crypt::Random::Source::Base::Handle);
    sub open_handle {
        # invoked as needed
    }
    # this class can also be used directly
    Crypt::Random::Source::Base::Handle->new( handle => $file_handle );
    # it supports some standard methods:
    $p->blocking(0);
    $p->read( my $buf, $n ); # no error handling here

Version

version 0.14

Overview

This is a concrete base class for all IO::Handle based random data sources.

It implements error handling

Attributes

handle

An IO::Handle or file handle to read from.

blocking

This is actually handled by "handle", and is documented in IO::Handle.

allow_under_read

Whether or not under reading is considered an error.

Defaults to false.

reread_attempts

The number of attempts to make at rereading if the handle did not provide enough bytes on the first attempt.

Defaults to 1.

Only used if "allow_under_read" is enabled.

Methods

get

See "get" in Crypt::Random::Source::Base.

When "blocking" or "allow_under_read" are set to a true value this method may return fewer bytes than requested.

read

This delegates directly to "handle".

It DOES NOT provide the same validation as "get" would have, so no checking for underreads is done.

close

Close the handle and clear it.

_read

"$self->handle->read" but with additional error checking and different calling conventions.

_read_too_short

Called by "_read" when not enough data was read from the handle. Normally it will either die with an error or attempt to reread. When "allow_under_read" is true it will just return the partial buffer.

open_handle

Abstract method, should return an IO::Handle to use.

Support

Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Crypt-Random-Source> (or [email protected] <mailto:[email protected]>).

Releases

7 releases since Debian 7 (Wheezy); the text changed 4 times.

  1. 7
  2. 8
  3. 9
  4. 10–11
  5. 12–13

Author

XXXX XXX'XX (Yuval Kogman) <[email protected]>

From libcrypt-random-source-perl 0.14-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.