1Crypt::Random::Source::UBsaesre:C:oHnatnrdilbeu(t3epdmC)Preyrplt:D:oRcaunmdeonmt:a:tSioounrce::Base::Handle(3pm)
2
3
4
6 Crypt::Random::Source::Base::Handle - IO::Handle based random data
7 sources
8
10 version 0.14
11
13 use Moo;
14 extends qw(Crypt::Random::Source::Base::Handle);
15
16 sub open_handle {
17 # invoked as needed
18 }
19
20
21 # this class can also be used directly
22 Crypt::Random::Source::Base::Handle->new( handle => $file_handle );
23
24
25 # it supports some standard methods:
26
27 $p->blocking(0);
28
29 $p->read( my $buf, $n ); # no error handling here
30
32 This is a concrete base class for all IO::Handle based random data
33 sources.
34
35 It implements error handling
36
38 handle
39 An IO::Handle or file handle to read from.
40
41 blocking
42 This is actually handled by "handle", and is documented in IO::Handle.
43
44 allow_under_read
45 Whether or not under reading is considered an error.
46
47 Defaults to false.
48
49 reread_attempts
50 The number of attempts to make at rereading if the handle did not
51 provide enough bytes on the first attempt.
52
53 Defaults to 1.
54
55 Only used if "allow_under_read" is enabled.
56
58 get
59 See "get" in Crypt::Random::Source::Base.
60
61 When "blocking" or "allow_under_read" are set to a true value this
62 method may return fewer bytes than requested.
63
64 read
65 This delegates directly to "handle".
66
67 It DOES NOT provide the same validation as "get" would have, so no
68 checking for underreads is done.
69
70 close
71 Close the handle and clear it.
72
73 _read
74 "$self->handle->read" but with additional error checking and different
75 calling conventions.
76
77 _read_too_short
78 Called by "_read" when not enough data was read from the handle.
79 Normally it will either die with an error or attempt to reread. When
80 "allow_under_read" is true it will just return the partial buffer.
81
82 open_handle
83 Abstract method, should return an IO::Handle to use.
84
86 Bugs may be submitted through the RT bug tracker
87 <https://rt.cpan.org/Public/Dist/Display.html?Name=Crypt-Random-Source>
88 (or bug-Crypt-Random-Source@rt.cpan.org <mailto:bug-Crypt-Random-
89 Source@rt.cpan.org>).
90
92 XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org>
93
95 This software is copyright (c) 2008 by Yuval Kogman.
96
97 This is free software; you can redistribute it and/or modify it under
98 the same terms as the Perl 5 programming language system itself.
99
100
101
102perl v5.34.0 2022-C0r1y-p2t1::Random::Source::Base::Handle(3pm)