Crypt:...e::Base(3pm)

๐Ÿ’– Crypt::Random::Source::Base ๐Ÿ’–

okay bestie, welcome to the abstract base class for all the Crypt::Random::Source classes โ€” she's the blueprint, the mother, the template, the it girl of random data. This is the 3pm manual page, and yes we're getting into it. ๐ŸŽ€


โœจ VERSION โœจ

version 0.14 โ€” that's the one, no cap.


๐ŸŒธ SYNOPSIS ๐ŸŒธ

the vibe check in code form, literally just:

use Moo;
extends qw(Crypt::Random::Source::Base);

slay. that's it. that's the whole mood. ๐Ÿ’…


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So this is an abstract base class. You don't instantiate her directly, she's not a main character you can just call, she's the ancestor everybody else inherits from. Iconic behavior only. ๐Ÿ‘‘

and likeโ€ฆ plot twist for the future: she's going to be a role at some point. so jot that down. ๐Ÿ”ฎ


โœจ METHODS โœจ

get $n, %args

grabs $n random bytes and hands them back to you as a string. cute right?

โš ๏ธ but ngl, this one may produce fatal errors if the source couldn't give you enough data. like, the source literally could not serve. tragic. ๐Ÿ’€

read $buf, $n, [ $off ]

okay so this method is cannibalized from IO::Scalar (she ate, fr fr) and it provides an IO::Handle work-alike. so you can treat it like an IO handle, iykyk. ๐Ÿซถ

heads up: subclasses override this so they can operate on a real handle directly if one's available. different, but make it efficient. โœจ

seed @stuff

on the sources that support it, this one adds @stuff โ€” whatever @stuff even is, no questions asked โ€” to the random seed. ๐ŸŒฑ

โš ๏ธ but some sources may not support this, so likeโ€ฆ be careful. don't just assume. ๐Ÿ™ˆ

available

this is a class method! and when it returns true, calling new with no arguments on the class should give you a working source of random data. periodt.

also it's used by Crypt::Random::Source::Factory โ€” so she's doing the lord's work behind the scenes. ๐Ÿ’œ

rank

another class method, and she's got some futz value for a ranking. the whole point is helping the known-good sources get tried before the known-bad ones (aka the slower, less available ones). queen shit. ๐Ÿ‘‘

get_data %Params

this one's just here for compatibility with Crypt::Random. she's a little throwback, we love her for that. ๐ŸŒˆ


๐ŸŽ€ SUPPORT ๐ŸŽ€

got bugs? bestie, please submit them through the RT bug tracker:

<https://rt.cpan.org/Public/Dist/Display.html?Name=Crypt-Random-Source>

or if you're feeling email-y:

<bug-Crypt-Random-Source@rt.cpan.org>

(that's the mailto: <bug-Crypt-Random-Source@rt.cpan.org> one, in case you were wondering) ๐Ÿ’Œ


โญ AUTHOR โญ

XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org> โ€” shoutout to the legend. ๐Ÿซก


This software is copyright (c) 2008 by Yuval Kogman.

and it's free software! you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so go off, respectfully. ๐Ÿ’…


and that's the whole page bestie ๐Ÿฆ‹ โ€” this was perl v5.34.0, dated 2022-04-09, and the manual you just read was Crypt:...e::Base(3pm). love that for us. mwah. ๐Ÿ’‹โœจ

๐Ÿ“ฆ where this page comes from