line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#=============================================================================== |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# DESCRIPTION: Export flows to XML |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# AUTHOR: Aliaksandr P. Zahatski, |
6
|
|
|
|
|
|
|
#=============================================================================== |
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Flow::To::XML - serialize flow to XML |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my ( $s, $s1 ); |
14
|
|
|
|
|
|
|
my $f1 = Flow::create_flow( |
15
|
|
|
|
|
|
|
Splice => 200, |
16
|
|
|
|
|
|
|
Join => { |
17
|
|
|
|
|
|
|
Data => Flow::create_flow( |
18
|
|
|
|
|
|
|
sub { |
19
|
|
|
|
|
|
|
return [ grep { $_ > 10 } @_ ]; |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
Splice => 10 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
), |
24
|
|
|
|
|
|
|
Min => Flow::create_flow( |
25
|
|
|
|
|
|
|
sub { |
26
|
|
|
|
|
|
|
return [ grep { $_ == 1 } @_ ]; |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
Splice => 40, |
29
|
|
|
|
|
|
|
) |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
ToXML => \$s, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
$f1->run( 1, 3, 11 ); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Flow::To::XML - serialize flow to XML |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
package Flow::To::XML; |
42
|
8
|
|
|
8
|
|
949
|
use strict; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
325
|
|
43
|
8
|
|
|
8
|
|
42
|
use warnings; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
235
|
|
44
|
8
|
|
|
8
|
|
687
|
use Flow; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
108
|
|
45
|
6
|
|
|
6
|
|
23
|
use base 'Flow'; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
427
|
|
46
|
6
|
|
|
6
|
|
6972
|
use XML::Flow qw( ref2xml xml2ref); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
our $VERSION = '0.1'; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 new dst |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
new Flow::To::XML:: \$str |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub new { |
57
|
|
|
|
|
|
|
my $class = shift; |
58
|
|
|
|
|
|
|
my $dst = shift; |
59
|
|
|
|
|
|
|
my $xflow = ( new XML::Flow:: $dst ); |
60
|
|
|
|
|
|
|
return $class->SUPER::new( @_, _xml_flow => $xflow, ); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub begin { |
64
|
|
|
|
|
|
|
my $self = shift; |
65
|
|
|
|
|
|
|
$self->{_xml_flow}->startTag( "FLOW", makedby => __PACKAGE__ ); |
66
|
|
|
|
|
|
|
return $self->SUPER::begin(@_); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub flow { |
70
|
|
|
|
|
|
|
my $self = shift; |
71
|
|
|
|
|
|
|
my $xfl = $self->{_xml_flow}; |
72
|
|
|
|
|
|
|
$xfl->startTag("flow"); |
73
|
|
|
|
|
|
|
$xfl->write( \@_ ); |
74
|
|
|
|
|
|
|
$xfl->endTag("flow"); |
75
|
|
|
|
|
|
|
return $self->SUPER::flow(@_) |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub ctl_flow { |
80
|
|
|
|
|
|
|
my $self = shift; |
81
|
|
|
|
|
|
|
my $xfl = $self->{_xml_flow}; |
82
|
|
|
|
|
|
|
$xfl->startTag("ctl_flow"); |
83
|
|
|
|
|
|
|
$xfl->write( \@_ ); |
84
|
|
|
|
|
|
|
$xfl->endTag("ctl_flow"); |
85
|
|
|
|
|
|
|
return $self->SUPER::ctl_flow(@_) |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub end { |
90
|
|
|
|
|
|
|
my $self = shift; |
91
|
|
|
|
|
|
|
my $res = $self->SUPER::end(@_); |
92
|
|
|
|
|
|
|
$self->{_xml_flow}->endTag("FLOW"); |
93
|
|
|
|
|
|
|
return $res |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
__END__ |