4 use FS::UID qw(adminsuidsetup);
7 require 5.004; #srand(time|$$);
9 my $user = shift or die &usage;
10 &adminsuidsetup( $user );
12 my $amount = shift or die &usage;
14 my $seconds = shift or die &usage;
16 my $num_digits = shift or die &usage;
18 my $num_entries = shift or die &usage;
20 for ( 1 .. $num_entries ) {
21 my $identifier = join( '', map int(rand(10)), ( 1 .. $num_digits ) );
22 my $prepay_credit = new FS::prepay_credit {
23 'identifier' => $identifier,
25 'seconds' => $seconds,
27 my $error = $prepay_credit->insert;
29 print "$identifier\n";
33 die "Usage:\n\n generate-prepay user amount seconds num_digits num_entries";