line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FLAT::Regex::Util; |
2
|
2
|
|
|
2
|
|
847
|
use parent 'FLAT::Regex'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
10
|
|
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1126
|
use FindBin qw/$Bin/; |
|
2
|
|
|
|
|
1833
|
|
|
2
|
|
|
|
|
241
|
|
5
|
2
|
|
|
2
|
|
811
|
use lib qq{$Bin/../lib}; |
|
2
|
|
|
|
|
1069
|
|
|
2
|
|
|
|
|
12
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
261
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
31
|
|
8
|
2
|
|
|
2
|
|
8
|
use Carp; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
528
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub get_symbol { |
11
|
421
|
|
|
421
|
0
|
539
|
my $symbol_len = shift; |
12
|
421
|
|
100
|
|
|
1399
|
$symbol_len //= 1; |
13
|
421
|
|
|
|
|
1714
|
my @symbols = qw/0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z/; |
14
|
421
|
|
|
|
|
521
|
my $symbol = q{}; |
15
|
421
|
|
|
|
|
715
|
for ( 1 .. $symbol_len ) { |
16
|
421
|
|
|
|
|
1042
|
$symbol .= $symbols[ rand(36) ]; |
17
|
|
|
|
|
|
|
} |
18
|
421
|
50
|
|
|
|
1408
|
return ( $symbol_len > 1 ) ? sprintf( "[%s]", $symbol ) : $symbol; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_op { |
22
|
301
|
|
|
301
|
0
|
750
|
my @ops = ( '*', '+', '&', '', '', '', '', '', '', '' ); |
23
|
301
|
|
|
|
|
1050
|
return $ops[ rand(10) ]; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get_random { |
27
|
421
|
|
|
421
|
0
|
782
|
my ( $length, $symbol_len ) = @_; |
28
|
421
|
|
|
|
|
639
|
my $string = ''; |
29
|
421
|
100
|
|
|
|
742
|
if ( 1 < $length ) { |
30
|
301
|
|
|
|
|
596
|
$string = get_symbol() . get_op() . get_random( --$length ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else { |
33
|
120
|
|
|
|
|
285
|
$string = get_symbol($symbol_len); |
34
|
|
|
|
|
|
|
} |
35
|
421
|
|
|
|
|
1111
|
return $string; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub random_pre { |
39
|
120
|
|
|
120
|
0
|
4070
|
my ( $length, $symbol_len ) = @_; |
40
|
120
|
|
50
|
|
|
419
|
$length //= 8; |
41
|
120
|
|
100
|
|
|
691
|
$symbol_len //= 1; |
42
|
120
|
|
|
|
|
453
|
return FLAT::Regex::WithExtraOps->new( get_random( $length, $symbol_len ) ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |