Crypt:...:Handle(3pm)
π Crypt::Random::Source::Base::Handle β the manual, but make it cute π
okay bestie so this is Crypt::Random::Source::Base::Handle, from the Perl user-contributed docs, and it's literally the IO::Handle-based random data sources situation. no cap, this one's a whole vibe. π
β¨ VERSION β¨
version 0.14 π¦ (she's vintage, she's iconic, we respect her)
πΈ SYNOPSIS πΈ
okay so here's how you'd actually use her:
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
not me pointing out that last comment βreadreally does NOT do error handling, that's just how it is,getis the one with the manners π
π DESCRIPTION π
This is a concrete base class for all IO::Handle based random data sources. fr fr, that's her whole job. She's the blueprint, the main character, the template all the other handle-y random sources build on. π
She implements error handling. β¨ (yes queen, that's the whole sentence, she's efficient)
π¦ ATTRIBUTES π¦
handle
An IO::Handle or file handle to read from. That's it, that's the whole thing. π
blocking
ngl this one is actually handled by handle itself β it's documented over in IO::Handle. So like, go read that page, bestie, she's just vibing here. πΈ
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 ifallow_under_readis enabled. so like, don't set it and expect it to do anything unless you also flippedallow_under_readon. periodt.
π 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. π«Ά so heads up, she might give you less than you asked for and that's allowed, not a glitch.
read
This delegates directly to handle. π
It DOES NOT provide the same validation as get would have, so no checking for underreads is done. π no safety net, no vibe check, just raw delegation, iykyk.
close
Close the handle and clear it. bye bestie π she's gone, she's cleared, it's over.
_read
$self->handle->read but with additional error checking and different calling conventions. π₯ the underscore means she's private, so like, she's for internal use, but she's still doing the most.
_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. π
so like, tl;dr: either she panics, she tries again, or β if you told her underreading is fine β she just hands you the partial thing and moves on. iconic behaviour honestly.
open_handle
Abstract method, should return an IO::Handle to use. π§ this one's abstract, so you gotta implement it yourself, bestie, she's not gonna do it for you.
π SUPPORT π
Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Crypt-Random-Source> (or bug-Crypt-Random-Source@rt.cpan.org <mailto:bug-Crypt-Random-Source@rt.cpan.org>).
found a bug? go tell the tracker, don't suffer in silence, we're all friends here π
β AUTHOR β
XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org> β yeah the name's literally redacted in the source, we love a mystery, she's giving anonymous royalty π
π COPYRIGHT AND LICENCE π
This software is copyright (c) 2008 by Yuval Kogman.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. πΈ so like, go forth, remix, redistribute, slay responsibly.
and that's the whole page, bestie!! π this was generated from perl v5.34.0 and dated 2022-04-09, so like, that's the version energy we're running on. mwah, go read some random bytes responsibly πβ¨
π¦ where this page comes from
- debian bookworm: libcrypt-random-source-perl 0.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcrypt-random-source-perl 0.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcrypt-random-source-perl 0.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libcrypt-random-source-perl 0.14-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms