| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# @author Bodo (Hugo) Barwich |
|
3
|
|
|
|
|
|
|
# @version 2026-01-29 |
|
4
|
|
|
|
|
|
|
# @package Object::Meta |
|
5
|
|
|
|
|
|
|
# @subpackage lib/Object/Meta/File/List.pm |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# This Module defines Classes to manage Data in an indexed List |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
#--------------------------------- |
|
10
|
|
|
|
|
|
|
# Requirements: |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
#--------------------------------- |
|
13
|
|
|
|
|
|
|
# Features: |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#============================================================================== |
|
17
|
|
|
|
|
|
|
# The Object::Meta::File::List Package |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Object::Meta::File::List - Library to index C instances by |
|
22
|
|
|
|
|
|
|
their C field. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
package Object::Meta::File::List; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
|
29
|
|
|
|
|
|
|
#Dependencies |
|
30
|
|
|
|
|
|
|
|
|
31
|
2
|
|
|
2
|
|
134040
|
use parent 'Object::Meta::Named::List'; |
|
|
2
|
|
|
|
|
392
|
|
|
|
2
|
|
|
|
|
16
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
2
|
|
|
2
|
|
144
|
use Scalar::Util 'blessed'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
484
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
C implements a class which indexes C |
|
38
|
|
|
|
|
|
|
instances by their C field. It works exactly like the C |
|
39
|
|
|
|
|
|
|
class. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Additionally a C meta data field will be created for indexation and lookup. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The C meta data field is used to lookup entries. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
|
48
|
|
|
|
|
|
|
#Constructors |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
|
51
|
|
|
|
|
|
|
#Administration Methods |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 Administration Methods |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head3 Add ( [ C | DATA ] ) |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This works like C only that it handles |
|
60
|
|
|
|
|
|
|
C instances. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
If no parameter is given it creates an empty instance of C |
|
63
|
|
|
|
|
|
|
and adds it to the list |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
B |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 4 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item C |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
An instance of C to be added to the list. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item C |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
A hash with data to create an instance of C and add it to the list. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
B C - The object which was created or added. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
See L|Object::Meta::Named::List/"Add ( [ C | DATA ] )"> |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
See L|Object::Meta::List/"Add ( [ C | DATA ] )"> |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub Add { |
|
88
|
3
|
|
|
3
|
1
|
8
|
my $self = shift; |
|
89
|
3
|
|
|
|
|
4
|
my $mtaety = undef; |
|
90
|
|
|
|
|
|
|
|
|
91
|
3
|
50
|
|
|
|
5
|
if ( scalar(@_) > 0 ) { |
|
92
|
3
|
50
|
|
|
|
5
|
if ( defined blessed $_[0] ) { |
|
93
|
3
|
|
|
|
|
3
|
$mtaety = $_[0]; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
else #Parameter is not an Object |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
|
|
|
|
|
|
# Create the new Object::Meta::File object from the given parameters |
|
98
|
0
|
|
|
|
|
0
|
$mtaety = Object::Meta::File->new(@_); |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
3
|
50
|
33
|
|
|
13
|
if ( defined $mtaety && !$mtaety->isa('Object::Meta::File') ) { |
|
103
|
0
|
|
|
|
|
0
|
$mtaety = undef; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
3
|
50
|
|
|
|
6
|
$mtaety = Object::Meta::File->new unless ( defined $mtaety ); |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#Execute the Base Logic |
|
109
|
3
|
|
|
|
|
6
|
$self->SUPER::Add($mtaety); |
|
110
|
|
|
|
|
|
|
|
|
111
|
3
|
|
|
|
|
3
|
return $mtaety; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
return 1; |