line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FLAT::Regex::Util; |
2
|
2
|
|
|
2
|
|
1071
|
use parent 'FLAT::Regex'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1371
|
use FindBin qw/$Bin/; |
|
2
|
|
|
|
|
2267
|
|
|
2
|
|
|
|
|
326
|
|
5
|
2
|
|
|
2
|
|
1023
|
use lib qq{$Bin/../lib}; |
|
2
|
|
|
|
|
1401
|
|
|
2
|
|
|
|
|
13
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
340
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
56
|
|
8
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
658
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub get_symbol { |
11
|
421
|
|
|
421
|
0
|
627
|
my $symbol_len = shift; |
12
|
421
|
|
100
|
|
|
1521
|
$symbol_len //= 1; |
13
|
421
|
|
|
|
|
2343
|
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
|
|
|
|
|
709
|
my $symbol = q{}; |
15
|
421
|
|
|
|
|
882
|
for ( 1 .. $symbol_len ) { |
16
|
421
|
|
|
|
|
1224
|
$symbol .= $symbols[ rand(36) ]; |
17
|
|
|
|
|
|
|
} |
18
|
421
|
50
|
|
|
|
1689
|
return ( $symbol_len > 1 ) ? sprintf( "[%s]", $symbol ) : $symbol; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_op { |
22
|
301
|
|
|
301
|
0
|
888
|
my @ops = ( '*', '+', '&', '', '', '', '', '', '', '' ); |
23
|
301
|
|
|
|
|
1162
|
return $ops[ rand(10) ]; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get_random { |
27
|
421
|
|
|
421
|
0
|
907
|
my ( $length, $symbol_len ) = @_; |
28
|
421
|
|
|
|
|
748
|
my $string = ''; |
29
|
421
|
100
|
|
|
|
991
|
if ( 1 < $length ) { |
30
|
301
|
|
|
|
|
989
|
$string = get_symbol() . get_op() . get_random( --$length ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else { |
33
|
120
|
|
|
|
|
239
|
$string = get_symbol($symbol_len); |
34
|
|
|
|
|
|
|
} |
35
|
421
|
|
|
|
|
1268
|
return $string; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub random_pre { |
39
|
120
|
|
|
120
|
0
|
3918
|
my ( $length, $symbol_len ) = @_; |
40
|
120
|
|
50
|
|
|
461
|
$length //= 8; |
41
|
120
|
|
100
|
|
|
702
|
$symbol_len //= 1; |
42
|
120
|
|
|
|
|
539
|
return FLAT::Regex::WithExtraOps->new( get_random( $length, $symbol_len ) ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |