Diff -- /var/www/vhosts/3dshawn.com/site1/MODS/RandCode.pm
Diff
/var/www/vhosts/3dshawn.com/site1/MODS/RandCode.pm
added on local at 2026-07-10 18:57:30
Added
+32
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to c94e0b8e797d
to c94e0b8e797d
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.| 1 | package MODS::RandCode; | |
| 2 | ||
| 3 | use strict; | |
| 4 | ||
| 5 | sub new { | |
| 6 | my($class, %args) = @_; | |
| 7 | my $self = bless({}, $class); | |
| 8 | ||
| 9 | return $self; | |
| 10 | } | |
| 11 | ||
| 12 | ||
| 13 | sub generate{ | |
| 14 | my $class = shift; | |
| 15 | my $code_length = shift; | |
| 16 | ||
| 17 | ################################################ | |
| 18 | ### generate an alpha-numeric number - start ### | |
| 19 | my $code; | |
| 20 | my $codeLength=$code_length; | |
| 21 | ||
| 22 | my @chars=('a'..'z','A'..'Z','0'..'9'); | |
| 23 | foreach (1..$codeLength){ | |
| 24 | $code.=$chars[rand @chars]; | |
| 25 | } | |
| 26 | ### generate an alpha-numeric number - end ### | |
| 27 | ################################################ | |
| 28 | ||
| 29 | return $code; | |
| 30 | } | |
| 31 | ||
| 32 | 1; |