line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
12
|
|
|
12
|
|
528
|
use Feature::Compat::Class 0.04; |
|
12
|
|
|
|
|
236
|
|
|
12
|
|
|
|
|
69
|
|
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
3289
|
use v5.12; |
|
12
|
|
|
|
|
65
|
|
4
|
12
|
|
|
12
|
|
78
|
use utf8; |
|
12
|
|
|
|
|
36
|
|
|
12
|
|
|
|
|
94
|
|
5
|
12
|
|
|
12
|
|
398
|
use warnings; |
|
12
|
|
|
|
|
34
|
|
|
12
|
|
|
|
|
663
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
String::License::Naming - base class for names of licenses and license naming schemes |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version v0.0.5 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
L is a base class |
18
|
|
|
|
|
|
|
for how to constrain, enumerate, and present licenses. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This class cannot be instantiated on its own. |
21
|
|
|
|
|
|
|
Please use a subclass instead, |
22
|
|
|
|
|
|
|
e.g. L. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
package String::License::Naming v0.0.5; |
27
|
|
|
|
|
|
|
|
28
|
12
|
|
|
12
|
|
84
|
use namespace::clean; |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
84
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
class String::License::Naming; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
method list_schemes |
33
|
0
|
|
|
0
|
0
|
0
|
{ |
34
|
0
|
|
|
|
|
0
|
...; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
method list_licenses |
38
|
0
|
|
|
0
|
0
|
0
|
{ |
39
|
0
|
|
|
|
|
0
|
...; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub resolve_shortnames |
43
|
|
|
|
|
|
|
{ |
44
|
20
|
|
|
20
|
0
|
79
|
my ( $keys, $schemes, $bootstrap ) = @_; |
45
|
20
|
|
|
|
|
42
|
my ( @schemes, $fallback, %names ); |
46
|
|
|
|
|
|
|
|
47
|
20
|
100
|
100
|
|
|
8088
|
$keys = [ sort keys %Regexp::Pattern::License::RE ] |
48
|
|
|
|
|
|
|
unless defined $keys and scalar @$keys; |
49
|
|
|
|
|
|
|
|
50
|
20
|
|
|
|
|
373
|
for (@$schemes) { |
51
|
22
|
100
|
|
|
|
90
|
if ( $_ eq 'internal' ) { |
52
|
4
|
|
|
|
|
11
|
$fallback = 1; |
53
|
4
|
|
|
|
|
13
|
last; |
54
|
|
|
|
|
|
|
} |
55
|
18
|
|
|
|
|
56
|
push @schemes, $_; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
KEY: |
59
|
20
|
|
|
|
|
60
|
for my $key (@$keys) { |
60
|
11014
|
100
|
|
|
|
18506
|
for my $key2 ( |
61
|
|
|
|
|
|
|
@schemes |
62
|
8308
|
|
|
|
|
103778
|
? sort keys %{ $Regexp::Pattern::License::RE{$key} } |
63
|
|
|
|
|
|
|
: () |
64
|
|
|
|
|
|
|
) |
65
|
|
|
|
|
|
|
{ |
66
|
157440
|
|
|
|
|
196093
|
my %attr; |
67
|
157440
|
|
|
|
|
297410
|
my @attr = split /[.]/, $key2; |
68
|
|
|
|
|
|
|
|
69
|
157440
|
100
|
|
|
|
322777
|
next unless $attr[0] eq 'name'; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# TODO: simplify, and require R::P::License v3.8.1 |
72
|
24445
|
50
|
|
|
|
112335
|
if ( $Regexp::Pattern::License::VERSION < v3.8.1 ) { |
73
|
0
|
0
|
|
|
|
0
|
push @attr, undef |
74
|
|
|
|
|
|
|
if @attr % 2; |
75
|
0
|
|
|
|
|
0
|
%attr = @attr[ 2 .. $#attr ]; |
76
|
0
|
0
|
|
|
|
0
|
next if exists $attr{version}; |
77
|
0
|
0
|
|
|
|
0
|
next if exists $attr{until}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
else { |
80
|
24445
|
|
|
|
|
58197
|
%attr = @attr[ 2 .. $#attr ]; |
81
|
24445
|
100
|
|
|
|
51413
|
next if exists $attr{until}; |
82
|
|
|
|
|
|
|
} |
83
|
22897
|
|
|
|
|
47853
|
for my $org (@schemes) { |
84
|
27073
|
100
|
100
|
|
|
79475
|
if ( exists $attr{org} and $attr{org} eq $org ) { |
85
|
3864
|
|
|
|
|
13462
|
$names{$key} = $Regexp::Pattern::License::RE{$key}{$key2}; |
86
|
3864
|
|
|
|
|
14984
|
next KEY; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
7150
|
100
|
|
|
|
19272
|
if ($fallback) { |
|
|
100
|
|
|
|
|
|
91
|
1328
|
|
66
|
|
|
5480
|
$names{$key} = $Regexp::Pattern::License::RE{$key}{name} // $key; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
elsif ( exists $Regexp::Pattern::License::RE{$key}{name} ) { |
94
|
5238
|
|
|
|
|
14248
|
$names{$key} = $Regexp::Pattern::License::RE{$key}{name}; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
20
|
100
|
|
|
|
5630
|
my @result = $bootstrap ? sort keys %names : sort { lc $a cmp lc $b } |
|
19796
|
|
|
|
|
26993
|
|
99
|
|
|
|
|
|
|
values %names; |
100
|
|
|
|
|
|
|
|
101
|
20
|
|
|
|
|
3802
|
return @result; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=encoding UTF-8 |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Jonas Smedegaard C<< >> |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Copyright © 2023 Jonas Smedegaard |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This program is free software: |
115
|
|
|
|
|
|
|
you can redistribute it and/or modify it |
116
|
|
|
|
|
|
|
under the terms of the GNU Affero General Public License |
117
|
|
|
|
|
|
|
as published by the Free Software Foundation, |
118
|
|
|
|
|
|
|
either version 3, or (at your option) any later version. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
121
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; |
122
|
|
|
|
|
|
|
without even the implied warranty |
123
|
|
|
|
|
|
|
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
124
|
|
|
|
|
|
|
See the GNU Affero General Public License for more details. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
You should have received a copy |
127
|
|
|
|
|
|
|
of the GNU Affero General Public License along with this program. |
128
|
|
|
|
|
|
|
If not, see . |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |