|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
  
 
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # This file is part of Config-Model  | 
| 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # This software is Copyright (c) 2005-2022 by Dominique Dumont.  | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # This is free software, licensed under:  | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #   The GNU Lesser General Public License, Version 2.1, February 1999  | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #  | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package Config::Model::Lister 2.153; # TRIAL  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
12
 | 
59
 | 
 
 | 
 
 | 
  
59
  
 | 
 
 | 
465
 | 
 use strict;  | 
| 
 
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
149
 | 
    | 
| 
 
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1837
 | 
    | 
| 
13
 | 
59
 | 
 
 | 
 
 | 
  
59
  
 | 
 
 | 
351
 | 
 use warnings;  | 
| 
 
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
166
 | 
    | 
| 
 
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1470
 | 
    | 
| 
14
 | 
59
 | 
 
 | 
 
 | 
  
59
  
 | 
 
 | 
392
 | 
 use Exporter;  | 
| 
 
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
166
 | 
    | 
| 
 
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2308
 | 
    | 
| 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
16
 | 
59
 | 
 
 | 
 
 | 
  
59
  
 | 
 
 | 
398
 | 
 use vars qw/@EXPORT/;  | 
| 
 
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
183
 | 
    | 
| 
 
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
48829
 | 
    | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 @EXPORT = qw(applications models);  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub available_models {  | 
| 
21
 | 
59
 | 
 
 | 
  
100
  
 | 
  
59
  
 | 
  
0
  
 | 
29754
 | 
     my $test = shift || 0;  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
23
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
174
 | 
     my ( %categories, %appli_info, %applications );  | 
| 
24
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
     my %done_cat;  | 
| 
25
 | 
59
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
434
 | 
     my @dir_to_scan = $test ? qw/lib/ : @INC;  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
27
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
148
 | 
     foreach my $dir ( map { glob("$_/Config/Model/*.d") } @dir_to_scan ) {  | 
| 
 
 | 
495
 | 
 
 | 
 
 | 
 
 | 
 
 | 
20304
 | 
    | 
| 
28
 | 
222
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1555
 | 
         my ($cat) = ( $dir =~ m!.*/([\w\-]+)\.d! );  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
30
 | 
222
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
1080
 | 
         if ( $cat !~ /^user|system|application$/ ) {  | 
| 
31
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             warn "available_models: skipping unexpected category: $cat\n";  | 
| 
32
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             next;  | 
| 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
35
 | 
222
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14838
 | 
         foreach my $file ( sort glob("$dir/*") ) {  | 
| 
36
 | 
333
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
1517
 | 
             next if $file =~ m!/README!;  | 
| 
37
 | 
333
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
1321
 | 
             next if $file =~ /(~|\.bak|\.orig)$/;  | 
| 
38
 | 
333
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1647
 | 
             my ($appli) = ( $file =~ m!.*/([\w\-]+)! );  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             # ensure that an appli file of a cat is not parsed twice  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             # (useful in dev, where system appli file may clobber  | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             # appli file in dvelopment  | 
| 
43
 | 
333
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
1309
 | 
             next if $done_cat{$cat}{$appli};  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
45
 | 
177
 | 
 
 | 
 
 | 
 
 | 
 
 | 
657
 | 
             $appli_info{$appli}{_file} = $file;  | 
| 
46
 | 
177
 | 
 
 | 
 
 | 
 
 | 
 
 | 
364
 | 
             $appli_info{$appli}{_category} = $cat;  | 
| 
47
 | 
177
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
6775
 | 
             open my $fh, '<', $file || die "Can't open file $file:$!";  | 
| 
48
 | 
177
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3454
 | 
             while (<$fh>) {  | 
| 
49
 | 
236
 | 
 
 | 
 
 | 
 
 | 
 
 | 
726
 | 
                 chomp;  | 
| 
50
 | 
236
 | 
 
 | 
 
 | 
 
 | 
 
 | 
817
 | 
                 s/^\s+//;  | 
| 
51
 | 
236
 | 
 
 | 
 
 | 
 
 | 
 
 | 
720
 | 
                 s/\s+$//;  | 
| 
52
 | 
236
 | 
 
 | 
 
 | 
 
 | 
 
 | 
393
 | 
                 s/#.*//;  | 
| 
53
 | 
236
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1254
 | 
                 my ( $k, $v ) = split /\s*=\s*/;  | 
| 
54
 | 
236
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
646
 | 
                 next unless $v;  | 
| 
55
 | 
236
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
765
 | 
                 if ( $k =~ /model/i ) {  | 
| 
56
 | 
177
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
507
 | 
                     push @{ $categories{$cat} }, $appli unless $done_cat{$cat}{$appli};  | 
| 
 
 | 
177
 | 
 
 | 
 
 | 
 
 | 
 
 | 
623
 | 
    | 
| 
57
 | 
177
 | 
 
 | 
 
 | 
 
 | 
 
 | 
504
 | 
                     $done_cat{$cat}{$appli} = 1;  | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
                 }  | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
60
 | 
236
 | 
 
 | 
 
 | 
 
 | 
 
 | 
554
 | 
                 $appli_info{$appli}{$k} = $v;  | 
| 
61
 | 
236
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
2505
 | 
                 $applications{$appli} = $v if $k =~ /model/i;  | 
| 
62
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
63
 | 
177
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
2818
 | 
             die "Missing model line in file $file\n" unless $done_cat{$cat}{$appli};  | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
65
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
66
 | 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
678
 | 
     return \%categories, \%appli_info, \%applications;  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub models {  | 
| 
70
 | 
  
0
  
 | 
 
 | 
 
 | 
  
0
  
 | 
  
0
  
 | 
 
 | 
     my @i = available_models(@_);  | 
| 
71
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     return join( ' ', sort values %{ $i[2] } ) . "\n";  | 
| 
 
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
73
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
74
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub applications {  | 
| 
75
 | 
  
0
  
 | 
 
 | 
 
 | 
  
0
  
 | 
  
0
  
 | 
 
 | 
     my @i = available_models(@_);  | 
| 
76
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     return join( ' ', sort keys %{ $i[2] } ) . "\n";  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
77
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
78
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
79
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
80
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
81
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # ABSTRACT: List available models and applications  | 
| 
82
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
83
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  | 
| 
84
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
85
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =pod  | 
| 
86
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
87
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =encoding UTF-8  | 
| 
88
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
89
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 NAME  | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
91
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 Config::Model::Lister - List available models and applications  | 
| 
92
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
93
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 VERSION  | 
| 
94
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
95
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 version 2.153  | 
| 
96
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
97
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 SYNOPSIS  | 
| 
98
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
99
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
  perl -MConfig::Model::Lister -e'print Config::Model::Lister::models;'  | 
| 
100
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
101
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
  perl -MConfig::Model::Lister -e'print Config::Model::Lister::applications;'  | 
| 
102
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
103
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 DESCRIPTION  | 
| 
104
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
105
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 Small modules to list available models or applications whose config  | 
| 
106
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 can be edited by L<cme>. This module is designed to be used by bash  | 
| 
107
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 completion.  | 
| 
108
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
109
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 All functions accept an optional boolean parameter. When true, only  | 
| 
110
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 the local C<lib> dir is scanned.  | 
| 
111
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
112
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 FUNCTIONS  | 
| 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
114
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 available_models  | 
| 
115
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
116
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 Returns an array of 3 hash refs:  | 
| 
117
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
118
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =over  | 
| 
119
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
120
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =item *  | 
| 
121
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
122
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 category (system or user or application) => application list. E.g.  | 
| 
123
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
124
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
  { system => [ 'popcon' , 'fstab'] }  | 
| 
125
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
126
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =item *  | 
| 
127
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
128
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 application name to model information. E.g.  | 
| 
129
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
130
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
  { 'multistrap' => { model => 'Multistrap', require_config_file => 1 }  | 
| 
131
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
132
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =item *  | 
| 
133
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
134
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 application name to model name. E.g.  | 
| 
135
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
136
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
  { popcon => 'Popcon', 'multistrap' => 'Multistrap' }  | 
| 
137
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
138
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =back  | 
| 
139
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
140
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 models  | 
| 
141
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
142
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 Returns a string with the list of models.  | 
| 
143
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
144
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 applications  | 
| 
145
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
146
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 Returns a string with the list of editable applications.  | 
| 
147
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
148
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 AUTHOR  | 
| 
149
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 Dominique Dumont  | 
| 
151
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
152
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =head1 COPYRIGHT AND LICENSE  | 
| 
153
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
154
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 This software is Copyright (c) 2005-2022 by Dominique Dumont.  | 
| 
155
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
156
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 This is free software, licensed under:  | 
| 
157
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
158
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   The GNU Lesser General Public License, Version 2.1, February 1999  | 
| 
159
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
160
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 =cut  |