line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSAN::Librarian::Library; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Implements a JavaScript::Librarian::Library object from a Config::Tiny |
4
|
|
|
|
|
|
|
# index of a JSAN installed lib. |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
5865
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
83
|
|
7
|
2
|
|
|
2
|
|
1205
|
use Config::Tiny (); |
|
2
|
|
|
|
|
1004
|
|
|
2
|
|
|
|
|
42
|
|
8
|
2
|
|
|
2
|
|
12
|
use Params::Util '_INSTANCE'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
113
|
|
9
|
2
|
|
|
2
|
|
12
|
use JSAN::Librarian::Book (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
38
|
|
10
|
2
|
|
|
2
|
|
2668
|
use JavaScript::Librarian::Library; |
|
2
|
|
|
|
|
770
|
|
|
2
|
|
|
|
|
53
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
13
|
use vars qw{$VERSION @ISA}; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
111
|
|
13
|
|
|
|
|
|
|
BEGIN { |
14
|
2
|
|
|
2
|
|
4
|
$VERSION = '0.03'; |
15
|
2
|
|
|
|
|
501
|
@ISA = 'JavaScript::Librarian::Library'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
##################################################################### |
23
|
|
|
|
|
|
|
# Constructor |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
26
|
1
|
|
|
1
|
1
|
1817
|
my $class = shift; |
27
|
1
|
|
|
|
|
3
|
my $config = undef; |
28
|
1
|
50
|
|
|
|
13
|
if ( _INSTANCE($_[0], 'Config::Tiny') ) { |
|
|
0
|
|
|
|
|
|
29
|
1
|
|
|
|
|
2
|
$config = shift; |
30
|
|
|
|
|
|
|
} elsif ( defined _STRING($_[0]) ) { |
31
|
0
|
0
|
|
|
|
0
|
$config = Config::Tiny->read($_[0]) or return undef; |
32
|
|
|
|
|
|
|
} else { |
33
|
0
|
|
|
|
|
0
|
return undef; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Remove any root entries |
37
|
1
|
|
|
|
|
3
|
delete $config->{_}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Create the object |
40
|
1
|
|
|
|
|
4
|
my $self = bless { |
41
|
|
|
|
|
|
|
config => $config, |
42
|
|
|
|
|
|
|
}, $class; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
3
|
$self; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _load_item_list { |
48
|
1
|
|
|
1
|
|
433
|
my $self = shift; |
49
|
1
|
|
|
|
|
2
|
my @books = (); |
50
|
1
|
|
|
|
|
2
|
my $config = $self->{config}; |
51
|
1
|
|
|
|
|
4
|
foreach my $book ( keys %$config ) { |
52
|
3
|
|
|
|
|
15
|
push @books, JSAN::Librarian::Book->new( $book, $config->{$book} ); |
53
|
|
|
|
|
|
|
} |
54
|
1
|
|
|
|
|
5
|
return \@books; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |