line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FLAT::Regex::Util; |
2
|
2
|
|
|
2
|
|
871
|
use parent 'FLAT::Regex'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
8
|
|
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1172
|
use FindBin qw/$Bin/; |
|
2
|
|
|
|
|
1937
|
|
|
2
|
|
|
|
|
267
|
|
5
|
2
|
|
|
2
|
|
883
|
use lib qq{$Bin/../lib}; |
|
2
|
|
|
|
|
1127
|
|
|
2
|
|
|
|
|
13
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
263
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
32
|
|
8
|
2
|
|
|
2
|
|
8
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
557
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub get_symbol { |
11
|
421
|
|
|
421
|
0
|
529
|
my $symbol_len = shift; |
12
|
421
|
|
100
|
|
|
1229
|
$symbol_len //= 1; |
13
|
421
|
|
|
|
|
1820
|
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
|
|
|
|
|
569
|
my $symbol = q{}; |
15
|
421
|
|
|
|
|
675
|
for ( 1 .. $symbol_len ) { |
16
|
421
|
|
|
|
|
1029
|
$symbol .= $symbols[ rand(36) ]; |
17
|
|
|
|
|
|
|
} |
18
|
421
|
50
|
|
|
|
1374
|
return ( $symbol_len > 1 ) ? sprintf( "[%s]", $symbol ) : $symbol; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_op { |
22
|
301
|
|
|
301
|
0
|
696
|
my @ops = ( '*', '+', '&', '', '', '', '', '', '', '' ); |
23
|
301
|
|
|
|
|
988
|
return $ops[ rand(10) ]; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get_random { |
27
|
421
|
|
|
421
|
0
|
705
|
my ( $length, $symbol_len ) = @_; |
28
|
421
|
|
|
|
|
601
|
my $string = ''; |
29
|
421
|
100
|
|
|
|
777
|
if ( 1 < $length ) { |
30
|
301
|
|
|
|
|
562
|
$string = get_symbol() . get_op() . get_random( --$length ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else { |
33
|
120
|
|
|
|
|
225
|
$string = get_symbol($symbol_len); |
34
|
|
|
|
|
|
|
} |
35
|
421
|
|
|
|
|
1094
|
return $string; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub random_pre { |
39
|
120
|
|
|
120
|
0
|
3621
|
my ( $length, $symbol_len ) = @_; |
40
|
120
|
|
50
|
|
|
405
|
$length //= 8; |
41
|
120
|
|
100
|
|
|
615
|
$symbol_len //= 1; |
42
|
120
|
|
|
|
|
466
|
return FLAT::Regex::WithExtraOps->new( get_random( $length, $symbol_len ) ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |