| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Geo::Privacy; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Geo::Privacy - Information about privacy/GDPR regulations by state |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 VERSION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Version 0.01 |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
All subroutines take an ISO 3166-1 two letter country abbreviation (case |
|
19
|
|
|
|
|
|
|
in-sensitive) and return a true/false value. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Geo::Privacy qw( is_eea_state is_gdpr_state ); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
if ( is_eea_state( 'it' ) ) { say "Yes, Italy is in the EEA" } |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
if ( is_gdpr_state( 'de' ) ) { say "GDPR does apply in Germany" } |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
52324
|
use 5.006; |
|
|
1
|
|
|
|
|
3
|
|
|
30
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
15
|
|
|
31
|
1
|
|
|
1
|
|
14
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
32
|
1
|
|
|
1
|
|
436
|
use Readonly; |
|
|
1
|
|
|
|
|
3051
|
|
|
|
1
|
|
|
|
|
41
|
|
|
33
|
1
|
|
|
1
|
|
362
|
use Exporter::Lite; |
|
|
1
|
|
|
|
|
557
|
|
|
|
1
|
|
|
|
|
4
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our @EXPORT = (); |
|
36
|
|
|
|
|
|
|
our @EXPORT_OK = qw( is_eu_state is_gdpr_state is_eea_state has_data_retention_regulations ); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Readonly our %EEA_STATES => ( |
|
39
|
|
|
|
|
|
|
# Taken from https://en.wikipedia.org/wiki/European_Economic_Area |
|
40
|
|
|
|
|
|
|
# State, Signed, Ratified, Entered into force, Notes |
|
41
|
|
|
|
|
|
|
AT => 1, #Austria 2 May 1992 15 October 1992 1 January 1994 EU member (from 1 January 1995) Acceded to the EEA as an EFTA member[14] |
|
42
|
|
|
|
|
|
|
BE => 1, #Belgium 2 May 1992 9 November 1993 1 January 1994 EU member |
|
43
|
|
|
|
|
|
|
BG => 1, #Bulgaria[15] 25 July 2007 29 February 2008 9 November 2011 EU member |
|
44
|
|
|
|
|
|
|
HR => 1, #Croatia[2] 11 April 2014 24 March 2015[16] No EU member (from 1 July 2013) Provisional application from 12 April 2014[2] |
|
45
|
|
|
|
|
|
|
CY => 1, #Cyprus[17] 14 October 2003 30 April 2004 6 December 2005 EU member (The agreement is not applied to Northern Cyprus[Note 2]) |
|
46
|
|
|
|
|
|
|
CZ => 1, #Czech Republic[17] 14 October 2003 10 June 2004 6 December 2005 EU member |
|
47
|
|
|
|
|
|
|
DK => 1, #Denmark 2 May 1992 30 December 1992 1 January 1994 EU member |
|
48
|
|
|
|
|
|
|
EU => 1, #European Union 2 May 1992 13 December 1993 1 January 1994 originally as European Economic Community and European Coal and Steel Community |
|
49
|
|
|
|
|
|
|
EE => 1, #Estonia[17] 14 October 2003 13 May 2004 6 December 2005 EU member |
|
50
|
|
|
|
|
|
|
FI => 1, #Finland 2 May 1992 17 December 1992 1 January 1994 EU member (from 1 January 1995) Acceded to the EEA as an EFTA member[14] |
|
51
|
|
|
|
|
|
|
FR => 1, #France 2 May 1992 10 December 1993 1 January 1994 EU member |
|
52
|
|
|
|
|
|
|
DE => 1, #Germany 2 May 1992 23 June 1993 1 January 1994 EU member |
|
53
|
|
|
|
|
|
|
GR => 1, #Greece 2 May 1992 10 September 1993 1 January 1994 EU member |
|
54
|
|
|
|
|
|
|
HU => 1, #Hungary[17] 14 October 2003 26 April 2004 6 December 2005 EU member |
|
55
|
|
|
|
|
|
|
IS => 1, #Iceland 2 May 1992 4 February 1993 1 January 1994 EFTA member |
|
56
|
|
|
|
|
|
|
IE => 1, #Ireland 2 May 1992 29 July 1993 1 January 1994 EU member |
|
57
|
|
|
|
|
|
|
IT => 1, #Italy 2 May 1992 15 November 1993 1 January 1994 EU member |
|
58
|
|
|
|
|
|
|
LV => 1, #Latvia[17] 14 October 2003 4 May 2004 6 December 2005 EU member |
|
59
|
|
|
|
|
|
|
LI => 1, #Liechtenstein 2 May 1992 25 April 1995 1 May 1995 EFTA member |
|
60
|
|
|
|
|
|
|
LT => 1, #Lithuania[17] 14 October 2003 27 April 2004 6 December 2005 EU member |
|
61
|
|
|
|
|
|
|
LU => 1, #Luxembourg 2 May 1992 21 October 1993 1 January 1994 EU member |
|
62
|
|
|
|
|
|
|
MT => 1, #Malta[17] 14 October 2003 5 March 2004 6 December 2005 EU member |
|
63
|
|
|
|
|
|
|
NL => 1, #Netherlands 2 May 1992 31 December 1992 1 January 1994 EU member |
|
64
|
|
|
|
|
|
|
NO => 1, #Norway 2 May 1992 19 November 1992 1 January 1994 EFTA member |
|
65
|
|
|
|
|
|
|
PL => 1, #Poland[17] 14 October 2003 8 October 2004 6 December 2005 EU member |
|
66
|
|
|
|
|
|
|
PT => 1, #Portugal 2 May 1992 9 March 1993 1 January 1994 EU member |
|
67
|
|
|
|
|
|
|
RO => 1, #Romania[15] 25 July 2007 23 May 2008 9 November 2011 EU member |
|
68
|
|
|
|
|
|
|
SK => 1, #Slovakia[17] 14 October 2003 19 March 2004 6 December 2005 EU member |
|
69
|
|
|
|
|
|
|
SI => 1, #Slovenia[17] 14 October 2003 30 June 2005 6 December 2005 EU member |
|
70
|
|
|
|
|
|
|
ES => 1, #Spain 2 May 1992 3 December 1993 1 January 1994 EU member |
|
71
|
|
|
|
|
|
|
SE => 1, #Sweden 2 May 1992 18 December 1992 1 January 1994 EU member (from 1 January 1995) Acceded to the EEA as an EFTA member[14] |
|
72
|
|
|
|
|
|
|
CH => 1, #Switzerland[14] 2 May 1992 No No EFTA member EEA ratification rejected in a 1992 referendum Removed as contracting party in 1993 protocol |
|
73
|
|
|
|
|
|
|
UK => 1, #United Kingdom |
|
74
|
|
|
|
|
|
|
); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Readonly our %EU_STATES => ( |
|
77
|
|
|
|
|
|
|
# Taken from https://europa.eu/european-union/about-eu/countries/member-countries_en |
|
78
|
|
|
|
|
|
|
AT => 1, #Austria |
|
79
|
|
|
|
|
|
|
BE => 1, #Belgium |
|
80
|
|
|
|
|
|
|
BG => 1, #Bulgaria |
|
81
|
|
|
|
|
|
|
HR => 1, #Croatia |
|
82
|
|
|
|
|
|
|
CY => 1, #Cyprus |
|
83
|
|
|
|
|
|
|
CZ => 1, #Czech Republic |
|
84
|
|
|
|
|
|
|
DK => 1, #Denmark |
|
85
|
|
|
|
|
|
|
EE => 1, #Estonia |
|
86
|
|
|
|
|
|
|
FI => 1, #Finland |
|
87
|
|
|
|
|
|
|
FR => 1, #France |
|
88
|
|
|
|
|
|
|
DE => 1, #Germany |
|
89
|
|
|
|
|
|
|
GR => 1, #Greece |
|
90
|
|
|
|
|
|
|
HU => 1, #Hungary |
|
91
|
|
|
|
|
|
|
#IS => 1, #Iceland - Not in EU |
|
92
|
|
|
|
|
|
|
IE => 1, #Ireland |
|
93
|
|
|
|
|
|
|
IT => 1, #Italy |
|
94
|
|
|
|
|
|
|
LV => 1, #Latvia |
|
95
|
|
|
|
|
|
|
#LI => 1, #Liechtenstein - Not in EU |
|
96
|
|
|
|
|
|
|
LT => 1, #Lithuania |
|
97
|
|
|
|
|
|
|
LU => 1, #Luxembourg |
|
98
|
|
|
|
|
|
|
MT => 1, #Malta |
|
99
|
|
|
|
|
|
|
NL => 1, #Netherlands |
|
100
|
|
|
|
|
|
|
#NO => 1, #Norway - Not in EU |
|
101
|
|
|
|
|
|
|
PL => 1, #Poland |
|
102
|
|
|
|
|
|
|
PT => 1, #Portugal |
|
103
|
|
|
|
|
|
|
RO => 1, #Romania |
|
104
|
|
|
|
|
|
|
SK => 1, #Slovakia |
|
105
|
|
|
|
|
|
|
SI => 1, #Slovenia |
|
106
|
|
|
|
|
|
|
ES => 1, #Spain |
|
107
|
|
|
|
|
|
|
SE => 1, #Sweden |
|
108
|
|
|
|
|
|
|
#CH => 1, #Switzerland - Not in EU |
|
109
|
|
|
|
|
|
|
UK => 1, #United Kingdom |
|
110
|
|
|
|
|
|
|
); |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Readonly our %OTHER_PRIVACY_STATES => ( |
|
114
|
|
|
|
|
|
|
AU => 1, # Australia |
|
115
|
|
|
|
|
|
|
CA => 1, # Candada |
|
116
|
|
|
|
|
|
|
); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 EXPORT |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 is_eu_state |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Return true if the specified state is a member of the European Union. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub is_eu_state { |
|
129
|
0
|
|
|
0
|
1
|
|
return $EU_STATES{ _normalize_state( @_ ) }; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 is_gdpr_state |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Return true if the specified state is subject to the protections in GDPR. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub is_gdpr_state { |
|
139
|
0
|
|
|
0
|
1
|
|
return is_eu_state(@_); |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 is_eea_state |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Return true if the specified state is a member of the European Economic Area |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub is_eea_state { |
|
149
|
0
|
|
|
0
|
1
|
|
return $EEA_STATES{ _normalize_state( @_ ) }; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 has_data_retention_regulations |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Return true if the specified state is known to have regulations related to the retention of data about its citizens. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Currently, this includes GDPR states as well as Austrailia and Canada. |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub has_data_retention_regulations { |
|
161
|
0
|
|
|
0
|
1
|
|
my $cc = _normalize_state( @_ ); |
|
162
|
0
|
|
0
|
|
|
|
return $EEA_STATES{$cc} || $OTHER_PRIVACY_STATES{$cc}; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub _normalize_state { |
|
167
|
0
|
|
|
0
|
|
|
my ($cc) = @_; |
|
168
|
0
|
|
|
|
|
|
$cc =~ s/\s//g; |
|
169
|
0
|
|
|
|
|
|
$cc = uc($cc); |
|
170
|
0
|
0
|
|
|
|
|
if ( $cc eq 'GB' ) { return 'UK' } |
|
|
0
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
|
return $cc; |
|
172
|
|
|
|
|
|
|
} |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 AUTHOR |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Dan Wright (dan at dwright dot org) |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 BUGS |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Please report any bugs or feature requests to L. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Copyright 2018 Dan Wright |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
187
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
188
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
See L for more information. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 DISCLAIMER |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
195
|
|
|
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
196
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
197
|
|
|
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
|
198
|
|
|
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
199
|
|
|
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
200
|
|
|
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
|
201
|
|
|
|
|
|
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
202
|
|
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
203
|
|
|
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=cut |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
1; # End of Geo::Privacy |