1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
package Crypt::Random::Source::Base::RandomDevice;
# ABSTRACT: Base class for random devices
our $VERSION = '0.14';
use Moo;
extends qw(Crypt::Random::Source::Base::File);
use namespace::clean;
sub rank { 100 } # good quality, pretty fast
has '+path' => (
lazy => 1,
required => 0,
builder => "default_path",
);
sub available {
-r shift->default_path;
}
sub seed {
my ( $self, @args ) = @_;
my $fh = $self->open_handle("w+");
print $fh @args;
close $fh;
}
sub default_path {
die "abstract";
}
1;
=pod
=encoding UTF-8
=head1 NAME
Crypt::Random::Source::Base::RandomDevice - Base class for random devices
=head1 VERSION
version 0.14
=head1 SYNOPSIS
use Moo;
extends qw(Crypt::Random::Source::Base::RandomDevice);
sub default_path { "/dev/myrandom" }
=head1 DESCRIPTION
This is a base class for random device sources.
See L<Crypt::Random::Source::Strong::devrandom> and
L<Crypt::Random::Source::Weak::devurandom> for actual implementations.
=head1 SUPPORT
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Crypt-Random-Source>
(or L<bug-Crypt-Random-Source@rt.cpan.org|mailto:bug-Crypt-Random-Source@rt.cpan.org>).
=head1 AUTHOR
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
=head1 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.
=cut
__END__
# ex: set sw=4 et:
|