| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pipeline::Base; |
|
2
|
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
10110
|
use strict; |
|
|
16
|
|
|
|
|
29
|
|
|
|
16
|
|
|
|
|
544
|
|
|
4
|
16
|
|
|
16
|
|
77
|
use warnings::register; |
|
|
16
|
|
|
|
|
28
|
|
|
|
16
|
|
|
|
|
1847
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
13564
|
use Error; |
|
|
16
|
|
|
|
|
120052
|
|
|
|
16
|
|
|
|
|
110
|
|
|
7
|
16
|
|
|
16
|
|
13765
|
use Pipeline::Error::Construction; |
|
|
16
|
|
|
|
|
109
|
|
|
|
16
|
|
|
|
|
254
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = "3.12"; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
127
|
|
|
127
|
1
|
5363
|
my $class = shift; |
|
13
|
127
|
|
|
|
|
213
|
my $self = {}; |
|
14
|
127
|
100
|
|
|
|
753
|
if (bless($self, $class)->init( @_ )) { |
|
15
|
125
|
|
|
|
|
1094
|
return $self; |
|
16
|
|
|
|
|
|
|
} else { |
|
17
|
2
|
|
|
|
|
23
|
Pipeline::Error::Construction->throw(); |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init { |
|
22
|
121
|
|
|
121
|
1
|
160
|
my $self = shift; |
|
23
|
121
|
|
|
|
|
494
|
return 1; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub debug { |
|
27
|
134
|
|
|
134
|
1
|
169
|
my $self = shift; |
|
28
|
|
|
|
|
|
|
|
|
29
|
134
|
50
|
|
|
|
320
|
return 1 if !ref($self); |
|
30
|
|
|
|
|
|
|
|
|
31
|
134
|
|
|
|
|
226
|
my $level = shift; |
|
32
|
134
|
100
|
|
|
|
260
|
if (defined( $level )) { |
|
33
|
48
|
|
|
|
|
90
|
$self->{ debug } = $level; |
|
34
|
48
|
|
|
|
|
124
|
return $self; |
|
35
|
|
|
|
|
|
|
} else { |
|
36
|
86
|
|
|
|
|
964
|
return $self->{ debug }; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub emit { |
|
41
|
66
|
|
|
66
|
1
|
90
|
my $self = shift; |
|
42
|
66
|
|
|
|
|
97
|
my $mesg = shift; |
|
43
|
66
|
100
|
|
|
|
183
|
$self->log( $self->_format_message( $mesg ) ) if $self->debug; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub log { |
|
47
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
48
|
1
|
|
|
|
|
2
|
my $mesg = shift; |
|
49
|
1
|
|
|
|
|
9
|
print STDERR $mesg; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _format_message { |
|
53
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
|
54
|
1
|
|
|
|
|
2
|
my $mesg = shift; |
|
55
|
1
|
|
|
|
|
2
|
my $class = ref( $self ); |
|
56
|
1
|
|
|
|
|
4
|
return "[$class] $mesg\n"; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Pipeline::Base - base class for all classes in Pipeline distribution |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
use Pipeline::Base; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$object = Pipeline::Base->new() |
|
71
|
|
|
|
|
|
|
$object->debug( 10 ); |
|
72
|
|
|
|
|
|
|
$object->emit("message"); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
C is a class that provides a basic level of functionality |
|
77
|
|
|
|
|
|
|
for all classes in the Pipeline system. Most importantly it provides the |
|
78
|
|
|
|
|
|
|
construction and initialization of new objects. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 METHODS |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=over 4 |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item CLASS->new() |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
The C method is a constructor that returns an instance of receiving |
|
87
|
|
|
|
|
|
|
class. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item init( LIST ); |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
C is called by the constructor, C and is passed all of its |
|
92
|
|
|
|
|
|
|
arguments in LIST. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item debug( [ SCALAR ] ) |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
The C method gets and sets the debug state of the OBJECT. Setting it |
|
97
|
|
|
|
|
|
|
to a true value will cause messages sent to C to be printed to the |
|
98
|
|
|
|
|
|
|
terminal. If debug() is called as a class method it always will return true. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item emit( SCALAR ) |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
C is a debugging tool. It will cause the the SCALAR to be formatted and |
|
103
|
|
|
|
|
|
|
sent to the C method if the current debugging level is set to a true value. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item log( SCALAR ) |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
The C method will send SCALAR to STDERR by default. It performs no processing |
|
108
|
|
|
|
|
|
|
of SCALAR and merely sends its results to the error handle. To change your logging |
|
109
|
|
|
|
|
|
|
mechanism simply override this method in the class as you see fit. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=back |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
James A. Duncan |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
|
118
|
|
|
|
|
|
|
|