line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#=============================================================================== |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# DESCRIPTION: Splice flow |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# AUTHOR: Aliaksandr P. Zahatski, |
6
|
|
|
|
|
|
|
#=============================================================================== |
7
|
|
|
|
|
|
|
#$Id$ |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Flow::Splice - Stream breakdown on a parts |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $f1 = Flow::create_flow( |
16
|
|
|
|
|
|
|
Splice => 200 ); |
17
|
|
|
|
|
|
|
$f1->run( 1, 3, 11 ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package Flow::Splice; |
22
|
8
|
|
|
8
|
|
40
|
use warnings; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
227
|
|
23
|
8
|
|
|
8
|
|
38
|
use strict; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
218
|
|
24
|
8
|
|
|
8
|
|
6139
|
use Data::Dumper; |
|
8
|
|
|
|
|
58902
|
|
|
8
|
|
|
|
|
811
|
|
25
|
8
|
|
|
8
|
|
63
|
use Flow; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
213
|
|
26
|
8
|
|
|
8
|
|
41
|
use base 'Flow'; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
3710
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
30
|
0
|
|
|
|
|
|
my $count = shift; |
31
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(@_); |
32
|
0
|
|
|
|
|
|
$self->{stack} = []; |
33
|
0
|
|
|
|
|
|
$self->{_Splice} = $count; |
34
|
0
|
|
|
|
|
|
return $self; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub purge_stack { |
39
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
40
|
0
|
|
|
|
|
|
my $stack = $self->{stack}; |
41
|
0
|
|
|
|
|
|
my $res; |
42
|
0
|
0
|
|
|
|
|
if ( scalar(@$stack) ) { |
43
|
0
|
|
|
|
|
|
$res = $self->put_flow(@$stack); |
44
|
0
|
|
|
|
|
|
@$stack = (); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
$res #return put_flow res |
47
|
0
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub ctl_flow { |
50
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
51
|
0
|
|
|
|
|
|
my $state = $self->purge_stack(); |
52
|
0
|
|
0
|
|
|
|
return $state || $self->SUPER::ctl_flow(@_); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub flow { |
56
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
57
|
0
|
|
|
|
|
|
my $stack = $self->{stack}; |
58
|
0
|
|
|
|
|
|
my $count = $self->{_Splice}; |
59
|
0
|
|
|
|
|
|
foreach my $r (@_) { |
60
|
0
|
0
|
|
|
|
|
if ( @$stack >= $count ) { |
61
|
0
|
0
|
|
|
|
|
if ( my $status = $self->purge_stack() ) { return $status } |
|
0
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
push @$stack, $r; |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
|
return undef; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub end { |
69
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
70
|
0
|
|
|
|
|
|
my $stack = $self->{stack}; |
71
|
0
|
0
|
|
|
|
|
if ( my $status = $self->purge_stack() ) { return $status } |
|
0
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return \@_; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |