Bug 19463: (follow-up) Cosmetic changes

String::Random version 0.26 (on Jessie) does not yet support the rand_gen
parameter (0.27 does, newest is 0.29 on CPAN now).
So alt_rand is only used in determining the size on Jessie.
That might be enough though.
Adding a documention line in this regard.

Removing the obsolete max parameter.

Note: I timed alt_rand for the creation of a new Bytes::Random::Secure
object each time. But each call is about 0.1 milliseconds. So that
should be fine.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2017-10-18 13:59:06 +02:00 committed by Jonathan Druart
parent 0e9edcd3be
commit e772277a8a
1 changed files with 2 additions and 1 deletions

View File

@ -438,7 +438,8 @@ sub _gen_text {
my $regex = $size > 1
? '[A-Za-z][A-Za-z0-9_]{'.($size-1).'}'
: '[A-Za-z]';
my $random = String::Random->new( max => $size, rand_gen => \&alt_rand );
my $random = String::Random->new( rand_gen => \&alt_rand );
# rand_gen is only supported from 0.27 onward
return $random->randregex($regex);
}