CGI-Info
view release on metacpan or search on metacpan
t/extended_tests.t view on Meta::CPAN
reset_env();
$ENV{HTTP_HOST} = 'api.example.com';
my $domain = CGI::Info->new()->domain_name();
is($domain, 'api.example.com',
'domain_name() returns non-www host unchanged');
};
# ============================================================
# 44. browser_type() â priority order: mobile > search > robot > web
# Verify the cascade: mobile wins over everything
# ============================================================
subtest 'browser_type: mobile takes priority over robot detection' => sub {
reset_env();
# iPhone UA â would be classified as both mobile and potentially robot
# by some detectors; mobile must win
$ENV{HTTP_USER_AGENT} = 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X)';
$ENV{REMOTE_ADDR} = '1.2.3.4';
$ENV{IS_MOBILE} = 1;
my $info = CGI::Info->new();
is($info->browser_type(), 'mobile',
'mobile takes priority in browser_type() cascade');
};
# ============================================================
# 45. is_tablet() â TabletPC user agent
# Branch: $agent =~ /.+(iPad|TabletPC).+/
# ============================================================
subtest 'is_tablet: TabletPC user agent detected as tablet' => sub {
reset_env();
$ENV{HTTP_USER_AGENT} = 'Mozilla/5.0 (Windows NT 10.0; TabletPC; ARM)';
( run in 0.640 second using v1.01-cache-2.11-cpan-e93a5daba3e )