File Coverage

blib/lib/Woothee/DataSet.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 4 50.0
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 26 30 86.6


line stmt bran cond sub pod time code
1             package Woothee::DataSet;
2              
3 7     7   44126 use strict;
  7         13  
  7         188  
4 7     7   36 use warnings;
  7         13  
  7         160  
5 7     7   33 use Carp;
  7         12  
  7         599  
6              
7             our (@ISA, @EXPORT_OK);
8             BEGIN {
9 7     7   44 require Exporter;
10 7         75 our @ISA = qw(Exporter);
11 7         15437 our @EXPORT_OK = qw(dataset const);
12             }
13              
14             my $CONST = {
15             KEY_LABEL => "label",
16             KEY_NAME => "name",
17             KEY_TYPE => "type",
18             KEY_CATEGORY => "category",
19             KEY_OS => "os",
20             KEY_OS_VERSION => "os_version",
21             KEY_VENDOR => "vendor",
22             KEY_VERSION => "version",
23              
24             TYPE_BROWSER => "browser",
25             TYPE_OS => "os",
26             TYPE_FULL => "full",
27              
28             CATEGORY_PC => "pc",
29             CATEGORY_SMARTPHONE => "smartphone",
30             CATEGORY_MOBILEPHONE => "mobilephone",
31             CATEGORY_CRAWLER => "crawler",
32             CATEGORY_APPLIANCE => "appliance",
33             CATEGORY_MISC => "misc",
34              
35             ATTRIBUTE_NAME => "name",
36             ATTRIBUTE_CATEGORY => "category",
37             ATTRIBUTE_OS => "os",
38             ATTRIBUTE_OS_VERSION => "os_version",
39             ATTRIBUTE_VENDOR => "vendor",
40             ATTRIBUTE_VERSION => "version",
41              
42             VALUE_UNKNOWN => "UNKNOWN",
43              
44             CATEGORY_LIST => ["pc", "smartphone", "mobilephone", "crawler", "appliance", "misc", "UNKNOWN"],
45             ATTRIBUTE_LIST => ["name", "category", "os", "vendor", "version"],
46             };
47              
48             sub const {
49 18207     18207 0 28605 my ($klass, $const_name) = @_;
50 18207 50       24704 $const_name = $klass unless $const_name;
51 18207         46201 $CONST->{$const_name};
52             }
53              
54             my $DATASET = {};
55             {
56             # GENERATED from dataset.yaml at Sun Aug 20 01:08:28 JST 2017 by root
57             my $obj;
58             $obj = {label => 'MSIE', name => 'Internet Explorer', type => 'browser'};
59             $obj->{vendor} = 'Microsoft';
60             $DATASET->{'MSIE'} = $obj;
61             $obj = {label => 'Edge', name => 'Edge', type => 'browser'};
62             $obj->{vendor} = 'Microsoft';
63             $DATASET->{'Edge'} = $obj;
64             $obj = {label => 'Chrome', name => 'Chrome', type => 'browser'};
65             $obj->{vendor} = 'Google';
66             $DATASET->{'Chrome'} = $obj;
67             $obj = {label => 'Safari', name => 'Safari', type => 'browser'};
68             $obj->{vendor} = 'Apple';
69             $DATASET->{'Safari'} = $obj;
70             $obj = {label => 'Firefox', name => 'Firefox', type => 'browser'};
71             $obj->{vendor} = 'Mozilla';
72             $DATASET->{'Firefox'} = $obj;
73             $obj = {label => 'Opera', name => 'Opera', type => 'browser'};
74             $obj->{vendor} = 'Opera';
75             $DATASET->{'Opera'} = $obj;
76             $obj = {label => 'Vivaldi', name => 'Vivaldi', type => 'browser'};
77             $obj->{vendor} = 'Vivaldi Technologies';
78             $DATASET->{'Vivaldi'} = $obj;
79             $obj = {label => 'Sleipnir', name => 'Sleipnir', type => 'browser'};
80             $obj->{vendor} = 'Fenrir Inc.';
81             $DATASET->{'Sleipnir'} = $obj;
82             $obj = {label => 'Webview', name => 'Webview', type => 'browser'};
83             $obj->{vendor} = 'OS vendor';
84             $DATASET->{'Webview'} = $obj;
85             $obj = {label => 'Win', name => 'Windows UNKNOWN Ver', type => 'os'};
86             $obj->{category} = 'pc';
87             $DATASET->{'Win'} = $obj;
88             $obj = {label => 'Win10', name => 'Windows 10', type => 'os'};
89             $obj->{category} = 'pc';
90             $DATASET->{'Win10'} = $obj;
91             $obj = {label => 'Win8.1', name => 'Windows 8.1', type => 'os'};
92             $obj->{category} = 'pc';
93             $DATASET->{'Win8.1'} = $obj;
94             $obj = {label => 'Win8', name => 'Windows 8', type => 'os'};
95             $obj->{category} = 'pc';
96             $DATASET->{'Win8'} = $obj;
97             $obj = {label => 'Win7', name => 'Windows 7', type => 'os'};
98             $obj->{category} = 'pc';
99             $DATASET->{'Win7'} = $obj;
100             $obj = {label => 'WinVista', name => 'Windows Vista', type => 'os'};
101             $obj->{category} = 'pc';
102             $DATASET->{'WinVista'} = $obj;
103             $obj = {label => 'WinXP', name => 'Windows XP', type => 'os'};
104             $obj->{category} = 'pc';
105             $DATASET->{'WinXP'} = $obj;
106             $obj = {label => 'Win2000', name => 'Windows 2000', type => 'os'};
107             $obj->{category} = 'pc';
108             $DATASET->{'Win2000'} = $obj;
109             $obj = {label => 'WinNT4', name => 'Windows NT 4.0', type => 'os'};
110             $obj->{category} = 'pc';
111             $DATASET->{'WinNT4'} = $obj;
112             $obj = {label => 'WinMe', name => 'Windows Me', type => 'os'};
113             $obj->{category} = 'pc';
114             $DATASET->{'WinMe'} = $obj;
115             $obj = {label => 'Win98', name => 'Windows 98', type => 'os'};
116             $obj->{category} = 'pc';
117             $DATASET->{'Win98'} = $obj;
118             $obj = {label => 'Win95', name => 'Windows 95', type => 'os'};
119             $obj->{category} = 'pc';
120             $DATASET->{'Win95'} = $obj;
121             $obj = {label => 'WinPhone', name => 'Windows Phone OS', type => 'os'};
122             $obj->{category} = 'smartphone';
123             $DATASET->{'WinPhone'} = $obj;
124             $obj = {label => 'WinCE', name => 'Windows CE', type => 'os'};
125             $obj->{category} = 'smartphone';
126             $DATASET->{'WinCE'} = $obj;
127             $obj = {label => 'OSX', name => 'Mac OSX', type => 'os'};
128             $obj->{category} = 'pc';
129             $DATASET->{'OSX'} = $obj;
130             $obj = {label => 'MacOS', name => 'Mac OS Classic', type => 'os'};
131             $obj->{category} = 'pc';
132             $DATASET->{'MacOS'} = $obj;
133             $obj = {label => 'Linux', name => 'Linux', type => 'os'};
134             $obj->{category} = 'pc';
135             $DATASET->{'Linux'} = $obj;
136             $obj = {label => 'BSD', name => 'BSD', type => 'os'};
137             $obj->{category} = 'pc';
138             $DATASET->{'BSD'} = $obj;
139             $obj = {label => 'ChromeOS', name => 'ChromeOS', type => 'os'};
140             $obj->{category} = 'pc';
141             $DATASET->{'ChromeOS'} = $obj;
142             $obj = {label => 'Android', name => 'Android', type => 'os'};
143             $obj->{category} = 'smartphone';
144             $DATASET->{'Android'} = $obj;
145             $obj = {label => 'iPhone', name => 'iPhone', type => 'os'};
146             $obj->{category} = 'smartphone';
147             $DATASET->{'iPhone'} = $obj;
148             $obj = {label => 'iPad', name => 'iPad', type => 'os'};
149             $obj->{category} = 'smartphone';
150             $DATASET->{'iPad'} = $obj;
151             $obj = {label => 'iPod', name => 'iPod', type => 'os'};
152             $obj->{category} = 'smartphone';
153             $DATASET->{'iPod'} = $obj;
154             $obj = {label => 'iOS', name => 'iOS', type => 'os'};
155             $obj->{category} = 'smartphone';
156             $DATASET->{'iOS'} = $obj;
157             $obj = {label => 'FirefoxOS', name => 'Firefox OS', type => 'os'};
158             $obj->{category} = 'smartphone';
159             $DATASET->{'FirefoxOS'} = $obj;
160             $obj = {label => 'BlackBerry', name => 'BlackBerry', type => 'os'};
161             $obj->{category} = 'smartphone';
162             $DATASET->{'BlackBerry'} = $obj;
163             $obj = {label => 'BlackBerry10', name => 'BlackBerry 10', type => 'os'};
164             $obj->{category} = 'smartphone';
165             $DATASET->{'BlackBerry10'} = $obj;
166             $obj = {label => 'docomo', name => 'docomo', type => 'full'};
167             $obj->{category} = 'mobilephone';
168             $obj->{vendor} = 'docomo';
169             $obj->{os} = 'docomo';
170             $DATASET->{'docomo'} = $obj;
171             $obj = {label => 'au', name => 'au by KDDI', type => 'full'};
172             $obj->{category} = 'mobilephone';
173             $obj->{vendor} = 'au';
174             $obj->{os} = 'au';
175             $DATASET->{'au'} = $obj;
176             $obj = {label => 'SoftBank', name => 'SoftBank Mobile', type => 'full'};
177             $obj->{category} = 'mobilephone';
178             $obj->{vendor} = 'SoftBank';
179             $obj->{os} = 'SoftBank';
180             $DATASET->{'SoftBank'} = $obj;
181             $obj = {label => 'willcom', name => 'WILLCOM', type => 'full'};
182             $obj->{category} = 'mobilephone';
183             $obj->{vendor} = 'WILLCOM';
184             $obj->{os} = 'WILLCOM';
185             $DATASET->{'willcom'} = $obj;
186             $obj = {label => 'jig', name => 'jig browser', type => 'full'};
187             $obj->{category} = 'mobilephone';
188             $obj->{vendor} = '';
189             $obj->{os} = 'jig';
190             $DATASET->{'jig'} = $obj;
191             $obj = {label => 'emobile', name => 'emobile', type => 'full'};
192             $obj->{category} = 'mobilephone';
193             $obj->{vendor} = '';
194             $obj->{os} = 'emobile';
195             $DATASET->{'emobile'} = $obj;
196             $obj = {label => 'SymbianOS', name => 'SymbianOS', type => 'full'};
197             $obj->{category} = 'mobilephone';
198             $obj->{vendor} = '';
199             $obj->{os} = 'SymbianOS';
200             $DATASET->{'SymbianOS'} = $obj;
201             $obj = {label => 'MobileTranscoder', name => 'Mobile Transcoder', type => 'full'};
202             $obj->{category} = 'mobilephone';
203             $obj->{vendor} = '';
204             $obj->{os} = 'Mobile Transcoder';
205             $DATASET->{'MobileTranscoder'} = $obj;
206             $obj = {label => 'Nintendo3DS', name => 'Nintendo 3DS', type => 'full'};
207             $obj->{category} = 'appliance';
208             $obj->{vendor} = 'Nintendo';
209             $obj->{os} = 'Nintendo 3DS';
210             $DATASET->{'Nintendo3DS'} = $obj;
211             $obj = {label => 'NintendoDSi', name => 'Nintendo DSi', type => 'full'};
212             $obj->{category} = 'appliance';
213             $obj->{vendor} = 'Nintendo';
214             $obj->{os} = 'Nintendo DSi';
215             $DATASET->{'NintendoDSi'} = $obj;
216             $obj = {label => 'NintendoWii', name => 'Nintendo Wii', type => 'full'};
217             $obj->{category} = 'appliance';
218             $obj->{vendor} = 'Nintendo';
219             $obj->{os} = 'Nintendo Wii';
220             $DATASET->{'NintendoWii'} = $obj;
221             $obj = {label => 'NintendoWiiU', name => 'Nintendo Wii U', type => 'full'};
222             $obj->{category} = 'appliance';
223             $obj->{vendor} = 'Nintendo';
224             $obj->{os} = 'Nintendo Wii U';
225             $DATASET->{'NintendoWiiU'} = $obj;
226             $obj = {label => 'PSP', name => 'PlayStation Portable', type => 'full'};
227             $obj->{category} = 'appliance';
228             $obj->{vendor} = 'Sony';
229             $obj->{os} = 'PlayStation Portable';
230             $DATASET->{'PSP'} = $obj;
231             $obj = {label => 'PSVita', name => 'PlayStation Vita', type => 'full'};
232             $obj->{category} = 'appliance';
233             $obj->{vendor} = 'Sony';
234             $obj->{os} = 'PlayStation Vita';
235             $DATASET->{'PSVita'} = $obj;
236             $obj = {label => 'PS3', name => 'PlayStation 3', type => 'full'};
237             $obj->{category} = 'appliance';
238             $obj->{vendor} = 'Sony';
239             $obj->{os} = 'PlayStation 3';
240             $DATASET->{'PS3'} = $obj;
241             $obj = {label => 'PS4', name => 'PlayStation 4', type => 'full'};
242             $obj->{category} = 'appliance';
243             $obj->{vendor} = 'Sony';
244             $obj->{os} = 'PlayStation 4';
245             $DATASET->{'PS4'} = $obj;
246             $obj = {label => 'Xbox360', name => 'Xbox 360', type => 'full'};
247             $obj->{category} = 'appliance';
248             $obj->{vendor} = 'Microsoft';
249             $obj->{os} = 'Xbox 360';
250             $DATASET->{'Xbox360'} = $obj;
251             $obj = {label => 'XboxOne', name => 'Xbox One', type => 'full'};
252             $obj->{category} = 'appliance';
253             $obj->{vendor} = 'Microsoft';
254             $obj->{os} = 'Xbox One';
255             $DATASET->{'XboxOne'} = $obj;
256             $obj = {label => 'DigitalTV', name => 'InternetTVBrowser', type => 'full'};
257             $obj->{category} = 'appliance';
258             $obj->{vendor} = '';
259             $obj->{os} = 'DigitalTV';
260             $DATASET->{'DigitalTV'} = $obj;
261             $obj = {label => 'SafariRSSReader', name => 'Safari RSSReader', type => 'full'};
262             $obj->{category} = 'misc';
263             $obj->{vendor} = 'Apple';
264             $DATASET->{'SafariRSSReader'} = $obj;
265             $obj = {label => 'GoogleDesktop', name => 'Google Desktop', type => 'full'};
266             $obj->{category} = 'misc';
267             $obj->{vendor} = 'Google';
268             $DATASET->{'GoogleDesktop'} = $obj;
269             $obj = {label => 'WindowsRSSReader', name => 'Windows RSSReader', type => 'full'};
270             $obj->{category} = 'misc';
271             $obj->{vendor} = 'Microsoft';
272             $DATASET->{'WindowsRSSReader'} = $obj;
273             $obj = {label => 'VariousRSSReader', name => 'RSSReader', type => 'full'};
274             $obj->{category} = 'misc';
275             $obj->{vendor} = '';
276             $DATASET->{'VariousRSSReader'} = $obj;
277             $obj = {label => 'HTTPLibrary', name => 'HTTP Library', type => 'full'};
278             $obj->{category} = 'misc';
279             $obj->{vendor} = '';
280             $DATASET->{'HTTPLibrary'} = $obj;
281             $obj = {label => 'GoogleBot', name => 'Googlebot', type => 'full'};
282             $obj->{category} = 'crawler';
283             $obj->{vendor} = '';
284             $DATASET->{'GoogleBot'} = $obj;
285             $obj = {label => 'GoogleBotMobile', name => 'Googlebot Mobile', type => 'full'};
286             $obj->{category} = 'crawler';
287             $obj->{vendor} = '';
288             $DATASET->{'GoogleBotMobile'} = $obj;
289             $obj = {label => 'GoogleMediaPartners', name => 'Google Mediapartners', type => 'full'};
290             $obj->{category} = 'crawler';
291             $obj->{vendor} = '';
292             $DATASET->{'GoogleMediaPartners'} = $obj;
293             $obj = {label => 'GoogleFeedFetcher', name => 'Google Feedfetcher', type => 'full'};
294             $obj->{category} = 'crawler';
295             $obj->{vendor} = '';
296             $DATASET->{'GoogleFeedFetcher'} = $obj;
297             $obj = {label => 'GoogleAppEngine', name => 'Google AppEngine', type => 'full'};
298             $obj->{category} = 'crawler';
299             $obj->{vendor} = '';
300             $DATASET->{'GoogleAppEngine'} = $obj;
301             $obj = {label => 'GoogleWebPreview', name => 'Google Web Preview', type => 'full'};
302             $obj->{category} = 'crawler';
303             $obj->{vendor} = '';
304             $DATASET->{'GoogleWebPreview'} = $obj;
305             $obj = {label => 'YahooSlurp', name => 'Yahoo! Slurp', type => 'full'};
306             $obj->{category} = 'crawler';
307             $obj->{vendor} = '';
308             $DATASET->{'YahooSlurp'} = $obj;
309             $obj = {label => 'YahooJP', name => 'Yahoo! Japan', type => 'full'};
310             $obj->{category} = 'crawler';
311             $obj->{vendor} = '';
312             $DATASET->{'YahooJP'} = $obj;
313             $obj = {label => 'YahooPipes', name => 'Yahoo! Pipes', type => 'full'};
314             $obj->{category} = 'crawler';
315             $obj->{vendor} = '';
316             $DATASET->{'YahooPipes'} = $obj;
317             $obj = {label => 'Baiduspider', name => 'Baiduspider', type => 'full'};
318             $obj->{category} = 'crawler';
319             $obj->{vendor} = '';
320             $DATASET->{'Baiduspider'} = $obj;
321             $obj = {label => 'msnbot', name => 'msnbot', type => 'full'};
322             $obj->{category} = 'crawler';
323             $obj->{vendor} = '';
324             $DATASET->{'msnbot'} = $obj;
325             $obj = {label => 'bingbot', name => 'bingbot', type => 'full'};
326             $obj->{category} = 'crawler';
327             $obj->{vendor} = '';
328             $DATASET->{'bingbot'} = $obj;
329             $obj = {label => 'BingPreview', name => 'BingPreview', type => 'full'};
330             $obj->{category} = 'crawler';
331             $obj->{vendor} = '';
332             $DATASET->{'BingPreview'} = $obj;
333             $obj = {label => 'Yeti', name => 'Naver Yeti', type => 'full'};
334             $obj->{category} = 'crawler';
335             $obj->{vendor} = '';
336             $DATASET->{'Yeti'} = $obj;
337             $obj = {label => 'FeedBurner', name => 'Google FeedBurner', type => 'full'};
338             $obj->{category} = 'crawler';
339             $obj->{vendor} = '';
340             $DATASET->{'FeedBurner'} = $obj;
341             $obj = {label => 'facebook', name => 'facebook', type => 'full'};
342             $obj->{category} = 'crawler';
343             $obj->{vendor} = '';
344             $DATASET->{'facebook'} = $obj;
345             $obj = {label => 'twitter', name => 'twitter', type => 'full'};
346             $obj->{category} = 'crawler';
347             $obj->{vendor} = '';
348             $DATASET->{'twitter'} = $obj;
349             $obj = {label => 'trendictionbot', name => 'trendiction', type => 'full'};
350             $obj->{category} = 'crawler';
351             $obj->{vendor} = '';
352             $DATASET->{'trendictionbot'} = $obj;
353             $obj = {label => 'mixi', name => 'mixi', type => 'full'};
354             $obj->{category} = 'crawler';
355             $obj->{vendor} = '';
356             $DATASET->{'mixi'} = $obj;
357             $obj = {label => 'IndyLibrary', name => 'Indy Library', type => 'full'};
358             $obj->{category} = 'crawler';
359             $obj->{vendor} = '';
360             $DATASET->{'IndyLibrary'} = $obj;
361             $obj = {label => 'ApplePubSub', name => 'Apple iCloud', type => 'full'};
362             $obj->{category} = 'crawler';
363             $obj->{vendor} = '';
364             $DATASET->{'ApplePubSub'} = $obj;
365             $obj = {label => 'Genieo', name => 'Genieo Web Filter', type => 'full'};
366             $obj->{category} = 'crawler';
367             $obj->{vendor} = '';
368             $DATASET->{'Genieo'} = $obj;
369             $obj = {label => 'topsyButterfly', name => 'topsy Butterfly', type => 'full'};
370             $obj->{category} = 'crawler';
371             $obj->{vendor} = '';
372             $DATASET->{'topsyButterfly'} = $obj;
373             $obj = {label => 'rogerbot', name => 'SeoMoz rogerbot', type => 'full'};
374             $obj->{category} = 'crawler';
375             $obj->{vendor} = '';
376             $DATASET->{'rogerbot'} = $obj;
377             $obj = {label => 'AhrefsBot', name => 'ahref AhrefsBot', type => 'full'};
378             $obj->{category} = 'crawler';
379             $obj->{vendor} = '';
380             $DATASET->{'AhrefsBot'} = $obj;
381             $obj = {label => 'radian6', name => 'salesforce radian6', type => 'full'};
382             $obj->{category} = 'crawler';
383             $obj->{vendor} = '';
384             $DATASET->{'radian6'} = $obj;
385             $obj = {label => 'Hatena', name => 'Hatena', type => 'full'};
386             $obj->{category} = 'crawler';
387             $obj->{vendor} = '';
388             $DATASET->{'Hatena'} = $obj;
389             $obj = {label => 'goo', name => 'goo', type => 'full'};
390             $obj->{category} = 'crawler';
391             $obj->{vendor} = '';
392             $DATASET->{'goo'} = $obj;
393             $obj = {label => 'livedoorFeedFetcher', name => 'livedoor FeedFetcher', type => 'full'};
394             $obj->{category} = 'crawler';
395             $obj->{vendor} = '';
396             $DATASET->{'livedoorFeedFetcher'} = $obj;
397             $obj = {label => 'VariousCrawler', name => 'misc crawler', type => 'full'};
398             $obj->{category} = 'crawler';
399             $obj->{vendor} = '';
400             $DATASET->{'VariousCrawler'} = $obj;
401             }
402              
403             sub dataset {
404 1285     1285 0 4818 my ($klass, $label) = @_;
405 1285 50       2195 $label = $klass unless $label;
406 1285         3852 $DATASET->{$label};
407             }
408              
409             1;
410             __END__