line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Slackware::Slackget::MediaList; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1135
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
377
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Slackware::Slackget::List; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Slackware::Slackget::MediaList - A container of Slackware::Slackget::Media object |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 1.0.0 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.9.11'; |
19
|
|
|
|
|
|
|
our @ISA = qw( Slackware::Slackget::List ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This class is used by slack-get to represent a list of medias store in the medias.xml file. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Slackware::Slackget::MediaList; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $list = Slackware::Slackget::MediaList->new(); |
28
|
|
|
|
|
|
|
... |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
0
|
1
|
|
my ($class,%args) = @_ ; |
35
|
0
|
|
|
|
|
|
my $self={list_type => 'Slackware::Slackget::Media','root-tag' => 'media-list'}; |
36
|
0
|
|
|
|
|
|
foreach (keys(%args)) |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
|
|
|
$self->{$_} = $args{$_}; |
39
|
|
|
|
|
|
|
} |
40
|
0
|
|
|
|
|
|
bless($self,$class); |
41
|
0
|
|
|
|
|
|
return $self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 new |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Please read the L documentation for more informations on the list constructor. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 FUNCTIONS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This class inheritate from Slackware::Slackget::List, so have a look to this class for a complete list of methods. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 index_list |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Create an index on the MediaList. This index don't take many memory but speed a lot search, especially when you already have the media shortname ! |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
The index is build with the media shortname. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$list->index_list() ; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub index_list |
67
|
|
|
|
|
|
|
{ |
68
|
0
|
|
|
0
|
1
|
|
my $self = shift ; |
69
|
0
|
|
|
|
|
|
$self->{INDEX} = {} ; |
70
|
0
|
|
|
|
|
|
foreach my $media (@{$self->{LIST}}) |
|
0
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
{ |
72
|
0
|
|
|
|
|
|
$self->{INDEX}->{$media->shortname()} = $media ; |
73
|
|
|
|
|
|
|
} |
74
|
0
|
|
|
|
|
|
return 1; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 get_indexed |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Return a media, as well as Get() do but use the index to return it quickly. You must provide a media shortname to this method. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $media = $list->get_indexed('slackware') ; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub get_indexed |
86
|
|
|
|
|
|
|
{ |
87
|
0
|
|
|
0
|
1
|
|
my ($self, $id) = @_ ; |
88
|
0
|
|
|
|
|
|
return $self->{INDEX}->{$id} ; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHOR |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
DUPUIS Arnaud, C<< >> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 BUGS |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
98
|
|
|
|
|
|
|
C, or through the web interface at |
99
|
|
|
|
|
|
|
L. |
100
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
101
|
|
|
|
|
|
|
your bug as I make changes. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 SUPPORT |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
perldoc Slackware::Slackget::MediaList |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
You can also look for information at: |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=over 4 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item * Infinity Perl website |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
L |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item * slack-get specific website |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
L |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
L |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * CPAN Ratings |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
L |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * Search CPAN |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
L |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=back |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Thanks to Bertrand Dupuis (yes my brother) for his contribution to the documentation. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Copyright 2005 DUPUIS Arnaud, All Rights Reserved. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
149
|
|
|
|
|
|
|
under the same terms as Perl itself. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
1; # End of Slackware::Slackget::MediaList |