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