line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pipeline::Store::Simple; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
59
|
use strict; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
629
|
|
4
|
11
|
|
|
11
|
|
58
|
use warnings::register; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
1787
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
4994
|
use Pipeline::Store; |
|
11
|
|
|
|
|
59
|
|
|
11
|
|
|
|
|
331
|
|
7
|
11
|
|
|
11
|
|
67
|
use base qw( Pipeline::Store ); |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
3351
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = "3.12"; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub init { |
12
|
27
|
|
|
27
|
1
|
50
|
my $self = shift; |
13
|
27
|
50
|
|
|
|
312
|
if ($self->SUPER::init( @_ )) { |
14
|
27
|
|
|
|
|
157
|
$self->storehash( {} ); |
15
|
27
|
|
|
|
|
175
|
return 1; |
16
|
|
|
|
|
|
|
} else { |
17
|
0
|
|
|
|
|
0
|
return 0; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub storehash { |
22
|
56
|
|
|
56
|
0
|
75
|
my $self = shift; |
23
|
56
|
|
|
|
|
69
|
my $hash = shift; |
24
|
56
|
100
|
|
|
|
104
|
if (defined( $hash )) { |
25
|
27
|
|
|
|
|
137
|
$self->{ storehash } = $hash; |
26
|
27
|
|
|
|
|
91
|
return $self; |
27
|
|
|
|
|
|
|
} else { |
28
|
29
|
|
|
|
|
141
|
return $self->{ storehash }; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub set { |
33
|
13
|
|
|
13
|
1
|
31
|
my $self = shift; |
34
|
13
|
|
|
|
|
22
|
my $obj = shift; |
35
|
13
|
50
|
|
|
|
41
|
if (defined( $obj )) { |
36
|
13
|
|
|
|
|
48
|
$self->storehash->{ ref($obj) } = $obj; |
37
|
|
|
|
|
|
|
} |
38
|
13
|
|
|
|
|
51
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub get { |
42
|
16
|
|
|
16
|
1
|
25
|
my $self = shift; |
43
|
16
|
|
|
|
|
21
|
my $key = shift; |
44
|
16
|
|
|
|
|
33
|
return $self->storehash->{ $key }; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Pipeline::Store::Simple - simple store for pipelines |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SYNOPSIS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
use Pipeline::Store::Simple; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $store = Pipeline::Store::Simple->new(); |
59
|
|
|
|
|
|
|
$store->set( $object ); |
60
|
|
|
|
|
|
|
my $object = $store->get( $class ); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRIPTION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
C is a simple implementation of a Pipeline store. |
65
|
|
|
|
|
|
|
It stores things as in a hashref indexed by classname. You can add an object |
66
|
|
|
|
|
|
|
to a store by calling the set method with an object, and you can get an object |
67
|
|
|
|
|
|
|
by calling the get method with the classname of the object you wish to retrieve. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
C inherits from the C class and |
70
|
|
|
|
|
|
|
includes its methods also. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 METHODS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over 4 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item set( OBJECT ) |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The C method puts OBJECT in the store. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item get( SCALAR ) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The C method attempts to return an object of the class specified |
83
|
|
|
|
|
|
|
by SCALAR. If an object of that class does not exist in the store it |
84
|
|
|
|
|
|
|
returns undef instead. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SEE ALSO |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
C, C, C |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
James A. Duncan |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Copyright 2003 Fotango Ltd. All Rights Reserved. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This software is released under the same terms as Perl itself. |
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|