root/HTTP-MobileAgent/trunk/lib/HTTP/MobileAgent/Display.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::Display;
2 use strict;
3 __PACKAGE__->HTTP::MobileAgent::make_accessors(
4     qw(width height color depth)
5 );
6
7 use vars qw($VERSION);
8 $VERSION = 0.09;
9
10 sub new {
11     my($class, %data) = @_;
12     bless {%data}, $class;
13 }
14
15 sub size {
16     my $self = shift;
17     return wantarray ? ($self->width, $self->height) : $self->width * $self->height;
18 }
19
20 1;
21 __END__
22
23 =head1 NAME
24
25 HTTP::MobileAgent::Display - Display information for HTTP::MobileAgent
26
27 =head1 SYNOPSIS
28
29   use HTTP::MobileAgent;
30
31   my $agent   = HTTP::MobileAgent->new;
32   my $display = $agent->display;
33
34   my $width  = $display->width;
35   my $height = $display->height:
36   my($width, $height) = $display->size;
37
38   if ($display->color) {
39       my $depth = $display->depth;
40   }
41
42 =head1 DESCRIPTION
43
44 HTTP::MobileAgent::Display is a class for display information on
45 HTTP::MobileAgent. Handy for image resizing or dispatching.
46
47 =head1 METHODS
48
49 =over 4
50
51 =item width, height
52
53   $width  = $display->width;
54   $height = $display->height:
55
56 returns width and height of the display.
57
58 =item size
59
60   ($width, $height) = $display->size;
61   $size = $display->size;
62
63 returns width with height in array context, width * height in scalar context.
64
65 =item color
66
67   if ($display->color) { }
68
69 returns true if it has color capability.
70
71 =item depth
72
73   $depth = $display->depth;
74
75 returns color depth of the display.
76
77 =back
78
79 =head1 AUTHOR
80
81 Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>
82
83 This library is free software; you can redistribute it and/or modify
84 it under the same terms as Perl itself.
85
86 =head1 SEE ALSO
87
88 L<HTTP::MobileAgent>
89
90 =cut
Note: See TracBrowser for help on using the browser.