HTTP-MobileAgent
view release on metacpan or search on metacpan
lib/HTTP/MobileAgent/DoCoMo.pm view on Meta::CPAN
return $self->gps_compliant;
}
sub gps_compliant {
my $self = shift;
return $self->model =~ qr/$GPSModelsRe/;
}
sub user_id {
my $self = shift;
return $self->get_header( 'x-dcmguid' );
}
sub browser_version {
my $self = shift;
return $self->is_foma && $self->cache_size >= 500 ? '2.0' : '1.0';
}
1;
__END__
=head1 NAME
HTTP::MobileAgent::DoCoMo - NTT DoCoMo implementation
=head1 SYNOPSIS
use HTTP::MobileAgent;
local $ENV{HTTP_USER_AGENT} = "DoCoMo/1.0/P502i/c10";
my $agent = HTTP::MobileAgent->new;
printf "Name: %s\n", $agent->name; # "DoCoMo"
printf "Ver: %s\n", $agent->version; # 1.0
printf "HTML ver: %s\n", $agent->html_version; # 2.0
printf "Model: %s\n", $agent->model; # "P502i"
printf "Cache: %dk\n", $agent->cache_size; # 10
print "FOMA\n" if $agent->is_foma; # false
printf "Vendor: %s\n", $agent->vendor; # 'P'
printf "Series: %s\n", $agent->series; # "502i"
# only available with <form utn>
# e.g.) "DoCoMo/1.0/P503i/c10/serNMABH200331";
printf "Serial: %s\n", $agent->serial_number; # "NMABH200331"
# e.g.) "DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789)";
printf "Serial: %s\n", $agent->serial_number; # "0123456789abcde"
printf "Card ID: %s\n", $agent->card_id; # "01234567890123456789"
# e.g.) "DoCoMo/1.0/P502i (Google CHTML Proxy/1.0)"
printf "Comment: %s\n", $agent->comment; # "Google CHTML Proxy/1.0
# e.g.) "DoCoMo/1.0/D505i/c20/TB/W20H10"
printf "Status: %s\n", $agent->status; # "TB"
# only available in eggy/M-stage
# e.g.) "DoCoMo/1.0/eggy/c300/s32/kPHS-K"
printf "Bandwidth: %dkbps\n", $agent->bandwidth; # 32
# e.g.) "DoCoMo/2.0 SO902i(c100;TB;W30H16)"
print "XHTML compiant!\n" if $agent->xhtml_compliant; # true
# e.g.) "DoCoMo/2.0 P07A(c500;TB;W24H15)"
printf "Browser ver: %s\n", $agent->browser_version # 2.0
=head1 DESCRIPTION
HTTP::MobileAgent::DoCoMo is a subclass of HTTP::MobileAgent, which
implements NTT docomo i-mode user agents.
=head1 METHODS
See L<HTTP::MobileAgent/"METHODS"> for common methods. Here are
HTTP::MobileAgent::DoCoMo specific methods.
=over 4
=item version
$version = $agent->version;
returns DoCoMo version number like "1.0".
=item html_version
$html_version = $agent->html_version;
returns supported HTML version like '3.0'. retuns undef if unknown.
=item model
$model = $agent->model;
returns name of the model like 'P502i'.
=item cache_size
$cache_size = $agent->cache_size;
returns cache size as killobytes unit. returns 5 if unknown.
=item is_foma
if ($agent->is_foma) { }
retuns whether it's FOMA or not.
=item vendor
$vendor = $agent->vendor;
returns vender code like 'SO' for Sony. returns undef if unknown.
=item series
$series = $agent->series;
returns series name like '502i'. returns undef if unknown.
=item serial_number
$serial_number = $agent->serial_number;
returns hardware unique serial number (15 digit in FOMA, 11 digit
otherwise alphanumeric). Only available with E<lt>form utnE<gt>
attribute. returns undef otherwise.
=item card_id
$card_id = $agent->card_id;
returns FOMA Card ID (20 digit alphanumeric). Only available in FOMA
with E<lt>form utnE<gt> attribute. returns undef otherwise.
=item comment
$comment = $agent->comment;
returns comment on user agent string like 'Google Proxy'. returns
undef otherwise.
=item bandwidth
$bandwidth = $agent->bandwidth;
returns bandwidth like 32 as killobytes unit. Only vailable in eggy,
returns undef otherwise.
=item status
$status = $agent->status;
returns status like "TB", "TC", "TD" or "TJ", which means:
TB | Browsers
TC | Browsers with image off (only Available in HTML 5.0)
TD | Fetching JAR
TJ | i-Appli
=item xhtml_compliant
if ($agent->xhtml_compliant) { }
returns if the agent is XHTML compliant.
=item browser_version
if ($agent->browser_version > 2.0) { }
returns browser version(1.0 or 2.0).
=back
=head1 AUTHOR
Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L<HTTP::MobileAgent>
http://www.nttdocomo.co.jp/p_s/imode/spec/useragent.html
http://www.nttdocomo.co.jp/p_s/imode/spec/ryouiki.html
http://www.nttdocomo.co.jp/p_s/imode/tag/utn.html
http://www.nttdocomo.co.jp/p_s/mstage/visual/contents/cnt_mpage.html
=cut
( run in 0.729 second using v1.01-cache-2.11-cpan-119454b85a5 )