| 1 | package Enterprise::Licence::Generate; | ||
| 2 | 1 | ▶ | use utf8; use warnings; use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use parent 'Enterprise::Licence'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | sub generate { | ||
| 5 | 2 | ▶ | my $msg = $_[0]->{ch}->encode([split '', $_[0]->{secret}]); |
|
Subroutine
generate: called CC=1 SCAR=0.0
Pod
documented
| |||
| 6 | 2 | $msg =~ s/^(0*)//; | |
| 7 | 2 | my $n = '_' x length $1; | |
| 8 | my ($dec, $time, $end) = ( | ||
| 9 | $_[0]->bin2dec($msg) + $_[0]->bin2dec($_[0]->customer_offset($_[1])), | ||
| 10 | DateTime->now()->epoch(), | ||
| 11 | 2 | DateTime->now()->add(%{ $_[2] })->epoch(), | |
| 12 | ); | ||
| 13 | 2 | return sprintf("%s-%s-%s-%s", | |
| 14 | $_[0]->bi($dec) . $n, | ||
| 15 | $_[0]->bi($time), | ||
| 16 | $_[0]->bi($end), | ||
| 17 | $_[0]->bi($end - $time) | ||
| 18 | ); | ||
| 19 | } | ||
| 20 | 1 | 1; | |