Diff -- /var/www/vhosts/3dshawn.com/site1/MODS/RandCode.pm

O Operator
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
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.
1package MODS::RandCode;
2
3use strict;
4
5sub new {
6 my($class, %args) = @_;
7 my $self = bless({}, $class);
8
9 return $self;
10}
11
12
13sub 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
321;