use Data::Rand::Obscure::Generator; my $generator = Data::Rand::Obscure::Generator->new; # Some random hexadecimal string value. $value = $generator->create; ... # Random base64 value: $value = $generator->create_b64; # Random binary value: $value = $generator->create_bin; # Random hexadecimal value: $value = $generator->create_hex; ... # A random value containing only hexadecimal characters and 103 characters in length: $value = $generator->create_hex(length => 103);
An objectified version of Data::Rand::Obscure functionality
This is the actual workhorse of the distribution, Data::Rand::Obscure contains function wrappers around a singleton object.
Returns a Data::Rand::Obscure::Generator with the following methods:
create create_hex create_bin create_b64
You may optionally supply a seeder subroutine, which is called everytime a new value is to be generated. It should return some seed value that will be digested.
You may also optionally supply a digester subroutine, which is also called everytime a new value is to be generated. It should return a Digest object of some kind (which will be used to take the digest of the seed value).
Returns the seeding code reference for $generator
Returns the Digest-generating code reference for $generator
Create a random hexadecimal value and return it. If <length> is specificied, then the string will be <length> characters long.
If <length> is specified and not a multiple of 2, then $value will technically not be a valid hexadecimal value.
Create a random binary value and return it. If <length> is specificied, then the value will be <length> bytes long.
Create a random base64 value and return it. If <length> is specificied, then the value will be <length> bytes long.
If <length> is specified, then $value is (technically) not guaranteed to be a "legal" b64 value (since padding may be off, etc).
Robert Krimen, <rkrimen at cpan.org>
<rkrimen at cpan.org>
Please report any bugs or feature requests to bug-data-rand-obscure at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Rand-Obscure. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-data-rand-obscure at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Data::Rand::Obscure
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-Rand-Obscure
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Data-Rand-Obscure
CPAN Ratings
http://cpanratings.perl.org/d/Data-Rand-Obscure
Search CPAN
http://search.cpan.org/dist/Data-Rand-Obscure
This package was inspired by (and contains code taken from) the Catalyst::Plugin::Session package by Yuval Kogman
Copyright 2007 Robert Krimen, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Data::Rand::Obscure, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Rand::Obscure
CPAN shell
perl -MCPAN -e shell install Data::Rand::Obscure
For more information on module installation, please visit the detailed CPAN module installation guide.