Skip to content

Commit 3c897e9

Browse files
committed
Be private func
1 parent aadc408 commit 3c897e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+215
-231
lines changed

lib/Duadua.pm

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,19 @@ sub version {
212212
shift->_result->{version} || '';
213213
}
214214

215-
sub contain_mozilla {
215+
sub _contain_mozilla {
216216
return 1 if shift->{_contain_mozilla}
217217
}
218218

219-
sub contain_mozilla_top {
219+
sub _contain_mozilla_top {
220220
return 1 if shift->{_contain_mozilla_top}
221221
}
222222

223-
sub prefix {
223+
sub _prefix {
224224
return 1 if index(shift->{_ua}, shift) == 0;
225225
}
226226

227-
sub contain {
227+
sub _contain {
228228
return 1 if index(shift->{_ua}, shift) != -1;
229229
}
230230

@@ -377,22 +377,6 @@ Returns version from user agent string
377377
378378
The list of User Agent Parser
379379
380-
=item prefix
381-
382-
Returns true value if the User-Agent contains $str on the top.
383-
384-
=item contain($str)
385-
386-
Returns true value if the User-Agent contains $str.
387-
388-
=item contain_mozilla
389-
390-
Returns true value if the User-Agent contains 'Mozilla'.
391-
392-
=item contain_mozilla_top
393-
394-
Returns true value if the User-Agent contains 'Mozilla' on the top of User-Agent.
395-
396380
397381
=back
398382

lib/Duadua/Parser.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ sub parse {
4343
sub _detect_general_browser {
4444
my ($class, $d) = @_;
4545

46-
if ( index($d->ua, 'rowser') > 0 && $d->prefix('Mozilla/') ) {
46+
if ( index($d->ua, 'rowser') > 0 && $d->_prefix('Mozilla/') ) {
4747
if ( $d->ua =~ m![^a-zA-Z]([a-zA-Z]+[bB]rowser)/([\d.]+)! ) {
4848
my %h = %{$BLANK_UA};
4949
($h{name}, $h{version}) = ($1, $2);
@@ -57,9 +57,9 @@ sub _detect_general_bot {
5757

5858
my %h = %{$BLANK_UA};
5959

60-
if ( $d->contain('https://') || $d->contain('http://') ) {
60+
if ( $d->_contain('https://') || $d->_contain('http://') ) {
6161
$h{is_bot} = 1;
62-
if ( !$d->contain('Mozilla/') && $d->ua =~ m!^([^/;]+)/(v?[\d.]+)! ) {
62+
if ( !$d->_contain('Mozilla/') && $d->ua =~ m!^([^/;]+)/(v?[\d.]+)! ) {
6363
my ($name, $version) = ($1, $2);
6464
$h{name} = $name;
6565
$h{version} = $version;

lib/Duadua/Parser/Bot/AdIdxBot.pm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use warnings;
55
sub try {
66
my ($class, $d) = @_;
77

8-
if ( $d->contain('adidxbot/')
9-
&& $d->contain('+http://www.bing.com/bingbot.htm')
10-
&& $d->contain_mozilla ) {
8+
if ( $d->_contain('adidxbot/')
9+
&& $d->_contain('+http://www.bing.com/bingbot.htm')
10+
&& $d->_contain_mozilla ) {
1111
my $h = _set_property($d, 'AdIdxBot');
1212

1313
if ($d->opt_version) {
@@ -27,10 +27,10 @@ sub _set_property {
2727
is_bot => 1,
2828
};
2929

30-
if ( $d->contain('Windows') ) {
30+
if ( $d->_contain('Windows') ) {
3131
$h->{is_windows} = 1;
3232
}
33-
elsif ( $d->contain('iPhone') ) {
33+
elsif ( $d->_contain('iPhone') ) {
3434
$h->{is_ios} = 1;
3535
}
3636

lib/Duadua/Parser/Bot/AdstxtCom.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use Duadua::Util qw//;
66
sub try {
77
my ($class, $d) = @_;
88

9-
if ( $d->contain('adstxt.com/') ) {
9+
if ( $d->_contain('adstxt.com/') ) {
1010
my $h = {
1111
name => 'adstxt.com',
1212
is_bot => 1,

lib/Duadua/Parser/Bot/Applebot.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use warnings;
55
sub try {
66
my ($class, $d) = @_;
77

8-
if ( $d->contain('(Applebot/') ) {
8+
if ( $d->_contain('(Applebot/') ) {
99
my $h = {
1010
name => 'Applebot',
1111
is_bot => 1,

lib/Duadua/Parser/Bot/Baiduspider.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use warnings;
55
sub try {
66
my ($class, $d) = @_;
77

8-
if ( $d->contain('Baiduspider') ) {
8+
if ( $d->_contain('Baiduspider') ) {
99
my $h = {
1010
name => 'Baiduspider',
1111
is_bot => 1,

lib/Duadua/Parser/Bot/Barkrowler.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use Duadua::Util qw//;
66
sub try {
77
my ($class, $d) = @_;
88

9-
if ( $d->contain('Barkrowler/') ) {
9+
if ( $d->_contain('Barkrowler/') ) {
1010
my $h = {
1111
name => 'Barkrowler',
1212
is_bot => 1,

lib/Duadua/Parser/Bot/BingPreview.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use warnings;
55
sub try {
66
my ($class, $d) = @_;
77

8-
if ( $d->contain('BingPreview/')
9-
&& $d->contain_mozilla ) {
8+
if ( $d->_contain('BingPreview/')
9+
&& $d->_contain_mozilla ) {
1010
my $h = _set_property($d, 'BingPreview');
1111

1212
if ($d->opt_version) {
@@ -26,7 +26,7 @@ sub _set_property {
2626
is_bot => 1,
2727
};
2828

29-
if ( $d->contain('Windows') ) {
29+
if ( $d->_contain('Windows') ) {
3030
$h->{is_windows} = 1;
3131
}
3232

lib/Duadua/Parser/Bot/Bingbot.pm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use warnings;
55
sub try {
66
my ($class, $d) = @_;
77

8-
if ( $d->contain('bingbot/')
9-
&& $d->contain('+http://www.bing.com/bingbot.htm')
10-
&& $d->contain_mozilla ) {
8+
if ( $d->_contain('bingbot/')
9+
&& $d->_contain('+http://www.bing.com/bingbot.htm')
10+
&& $d->_contain_mozilla ) {
1111
my $h = _set_property($d, 'Bingbot');
1212

1313
if ($d->opt_version) {
@@ -27,10 +27,10 @@ sub _set_property {
2727
is_bot => 1,
2828
};
2929

30-
if ( $d->contain('Windows') ) {
30+
if ( $d->_contain('Windows') ) {
3131
$h->{is_windows} = 1;
3232
}
33-
elsif ( $d->contain('iPhone') ) {
33+
elsif ( $d->_contain('iPhone') ) {
3434
$h->{is_ios} = 1;
3535
}
3636

lib/Duadua/Parser/Bot/BotMisc.pm

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ sub try {
1414
is_bot => 1,
1515
};
1616
}
17-
elsif ( $d->contain('Yeti/')
18-
&& $d->contain('+http://') && $d->contain('naver.') ) {
17+
elsif ( $d->_contain('Yeti/')
18+
&& $d->_contain('+http://') && $d->_contain('naver.') ) {
1919
$h = {
2020
name => 'Naver Yeti',
2121
is_bot => 1,
@@ -26,13 +26,13 @@ sub try {
2626
$h->{version} = $version if $version;
2727
}
2828
}
29-
elsif ( $d->contain(' proximic;') ) {
29+
elsif ( $d->_contain(' proximic;') ) {
3030
$h = {
3131
name => 'Comscore crawler',
3232
is_bot => 1,
3333
};
3434
}
35-
elsif ( $d->contain(' Daum/') ) {
35+
elsif ( $d->_contain(' Daum/') ) {
3636
$h = {
3737
name => 'Daum',
3838
is_bot => 1,
@@ -45,7 +45,7 @@ sub try {
4545

4646
$h = Duadua::Util->set_os($d, $h);
4747
}
48-
elsif ( $d->contain('MixnodeCache/') ) {
48+
elsif ( $d->_contain('MixnodeCache/') ) {
4949
$h = {
5050
name => 'mixnode.com',
5151
is_bot => 1,
@@ -56,13 +56,13 @@ sub try {
5656
$h->{version} = $version if $version;
5757
}
5858
}
59-
elsif ( $d->contain('SearchAtlas.com ') ) {
59+
elsif ( $d->_contain('SearchAtlas.com ') ) {
6060
$h = {
6161
name => 'SearchAtlas.com',
6262
is_bot => 1,
6363
};
6464
}
65-
elsif ( $d->contain('ltx71') ) {
65+
elsif ( $d->_contain('ltx71') ) {
6666
$h = {
6767
name => 'ltx71',
6868
is_bot => 1,
@@ -74,7 +74,7 @@ sub try {
7474
is_bot => 1,
7575
};
7676
}
77-
elsif ( $d->contain(' FlipboardProxy/') ) {
77+
elsif ( $d->_contain(' FlipboardProxy/') ) {
7878
$h = {
7979
name => 'FlipboardProxy',
8080
is_bot => 1,
@@ -85,7 +85,7 @@ sub try {
8585
$h->{version} = $version if $version;
8686
}
8787
}
88-
elsif ( $d->contain(' BuiltWith/') ) {
88+
elsif ( $d->_contain(' BuiltWith/') ) {
8989
$h = {
9090
name => 'BuiltWith',
9191
is_bot => 1,
@@ -98,7 +98,7 @@ sub try {
9898

9999
$h = Duadua::Util->set_os($d, $h);
100100
}
101-
elsif ( $d->contain(' zgrab/') ) {
101+
elsif ( $d->_contain(' zgrab/') ) {
102102
$h = {
103103
name => 'ZGrab',
104104
is_bot => 1,
@@ -111,7 +111,7 @@ sub try {
111111

112112
$h = Duadua::Util->set_os($d, $h);
113113
}
114-
elsif ( $d->contain(' RyowlEngine/') ) {
114+
elsif ( $d->_contain(' RyowlEngine/') ) {
115115
$h = {
116116
name => 'RyowlEngine',
117117
is_bot => 1,
@@ -124,7 +124,7 @@ sub try {
124124

125125
$h = Duadua::Util->set_os($d, $h);
126126
}
127-
elsif ( $d->contain(' DataXu/') ) {
127+
elsif ( $d->_contain(' DataXu/') ) {
128128
$h = {
129129
name => 'DataXu',
130130
is_bot => 1,
@@ -137,7 +137,7 @@ sub try {
137137

138138
$h = Duadua::Util->set_os($d, $h);
139139
}
140-
elsif ( $d->contain('istellabot/') ) {
140+
elsif ( $d->_contain('istellabot/') ) {
141141
$h = {
142142
name => 'istellabot',
143143
is_bot => 1,
@@ -150,7 +150,7 @@ sub try {
150150

151151
$h = Duadua::Util->set_os($d, $h);
152152
}
153-
elsif ( $d->contain(' Cincraw/') ) {
153+
elsif ( $d->_contain(' Cincraw/') ) {
154154
$h = {
155155
name => 'Cincraw',
156156
is_bot => 1,
@@ -161,13 +161,13 @@ sub try {
161161
$h->{version} = $version if $version;
162162
}
163163
}
164-
elsif ( $d->contain('KOCMOHABT ') ) {
164+
elsif ( $d->_contain('KOCMOHABT ') ) {
165165
$h = {
166166
name => 'KOCMOHABT',
167167
is_bot => 1,
168168
};
169169
}
170-
elsif ( $d->contain('Hexometer') ) {
170+
elsif ( $d->_contain('Hexometer') ) {
171171
$h = {
172172
name => 'Hexometer',
173173
is_bot => 1,

0 commit comments

Comments
 (0)