root/HTTP-MobileAgent/trunk/lib/HTTP/MobileAgent/AirHPhone.pm

Revision 875 (checked in by miyagawa, 17 years ago)

version 0.09

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 package HTTP::MobileAgent::AirHPhone;
2
3 use strict;
4 use vars qw($VERSION);
5 $VERSION = 0.09;
6
7 use base qw(HTTP::MobileAgent);
8
9 __PACKAGE__->make_accessors(
10     qw(vendor model model_version browser_version cache_size)
11 );
12
13 sub is_airh_phone { 1 }
14
15 sub name { 'DDIPOCKET' }
16
17 sub parse {
18     my $self = shift;
19     my $ua = $self->user_agent;
20     $ua =~ m!^Mozilla/3\.0\(DDIPOCKET;(.*)\)CNF/2\.0$! or $self->no_match;
21     @{$self}{qw(vendor model model_version browser_version cache_size)} = split m!/!, $1;
22     $self->{cache_size} =~ s/^c//;
23 }
24
25 1;
26 __END__
27
28 =head1 NAME
29
30 HTTP::MobileAgent::AirHPhone - Air H" Phone implementation
31
32 =head1 SYNOPSIS
33
34   use HTTP::MobileAgent;
35
36   local $ENV{HTTP_USER_AGENT} = "Mozilla/3.0(DDIPOCKET;JRC/AH-J3001V,AH-J3002V/1.0/0100/c50)CNF/2.0";
37   my $agent = HTTP::MobileAgent->new;
38
39   printf "Name: %s\n", $agent->name;            # DDIPOCKET
40   printf "Vendor: %s\n", $agent->vendor;        # JRC
41   printf "Model: %s\n", $agent->model;          # AH-J3001V,AH-J3002V
42   printf "Model Version: %s\n", $agent->model_version;  # 1.0
43   printf "Browser Version: %s\n", $agent->browser_version;      # 0100
44   printf "Cache Size: %s\n", $agent->cache_size; # 50
45
46 =head1 DESCRIPTION
47
48 HTTP::MobileAgent::AirHPhone is a subclass of HTTP::MobileAgent, which
49 implements DDIPocket's Air H" Phone user agents.
50
51 =head1 METHODS
52
53 See L<HTTP::MobileAgent/"METHODS"> for common methods. Here are
54 HTTP::MobileAgent::AirHPhone specific methods.
55
56 =over 4
57
58 =item vendor
59
60   $vendor = $agent->vendor;
61
62 returns vendor name.
63
64 =item model
65
66   $model = $agent->model;
67
68 returns model name. Note that model names are separated with ','.
69
70 =item model_version
71
72   $model_ver = $agent->model_version;
73
74 returns version number of the model.
75
76 =item browser_version
77
78   $browser_ver = $agent->browser_version;
79
80 returns versino number of the browser.
81
82 =item cache_size
83
84   $cache_size = $agent->cache_size;
85
86 returns cache size with kilobyte unit.
87
88 =back
89
90 =head1 AUTHOR
91
92 Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>
93
94 This library is free software; you can redistribute it and/or modify
95 it under the same terms as Perl itself.
96
97 =head1 SEE ALSO
98
99 L<HTTP::MobileAgent>
100
101 http://www.ddipocket.co.jp/airh_phone/i_hp.html
102
103 =cut
Note: See TracBrowser for help on using the browser.