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