README
1NAME
2 HTML::MobileConverter - HTML Converter for mobile agent
3
4SYNOPSIS
5 use HTML::MobileConverter;
6
7 my $baseuri = 'http://example.com/';
8 my $c = HTML::MobileConverter->new(baseuri => $baseuri);
9 my $html = qq|<html><body>title<hr><a href="./my">my link</a></body></html>|;
10 print $c->convert($html); # get html with abs-uri.
11
12 use URI;
13 $html = qq|<html><body>title<hr><a href="./my">my link</a><iframe src="./my"></iframe></body></html>|;
14 $c = HTML::MobileConverter->new(
15 baseuri => $baseuri,
16 hrefhandler => sub {
17 my $href = shift;
18 return URI->new_abs($href, 'http://example.com/');
19 },
20 );
21 print $c->convert($html); # get html without iframe.
22
23 # create a proxy
24 my $q = CGI->new;
25 my $html = $c->convert(LWP::Simple:get($q->param('uri')));
26 print Jcode->new($html)->sjis;
27
28DESCRIPTION
29 HTML::MobileConverter parses HTML and returns new HTML for mobile agent
30 (mainly for DoCoMo i-mode). If the original HTML doesn't contain so many
31 pc tags, it returns the original HTML strings with absolute uri
32 (href,src...). If the original was guessed as a content for PC, it
33 returns new HTML for mobile agent.
34
35METHODS
36 Here are common methods of HTML::MobileConverter.
37
38 new
39 $c = HTML::MobileConverter->new;
40 $c = HTML::MobileConverter->new(baseuri => 'http://www.example.com/');
41 $c = HTML::MobileConverter->new(
42 baseuri => 'http://www.example.com/',
43 hrefhandler => sub {
44 my $href = shift;
45 $href = URI->new_abs($href, 'http://www.example.com/');
46 return qq|/browse?uri=$href|;
47 },
48 );
49
50 creates a instance of HTML::MobileConverter. If you specify
51 "baseuri", "href/src/action" attributes will be replaced with
52 absolute uris.
53
54 If you specify "hrefhandler" with some function, href attribute will
55 be handled with the handler.
56
57 convert
58 my $mhtml = $c->convert($html);
59
60 returns HTML strings for mobile.
61
62 ismobilecontent
63 print "is mobile" if $c->ismobilecontent;
64
65 returns which the original HTML was guessed as mobile content or
66 not.
67
68AUTHOR
69 Junya Kondo, <jkondo@hatena.ne.jp>
70
71COPYRIGHT AND LICENSE
72 Copyright (C) 2005 by Junya Kondo
73
74 This library is free software; you can redistribute it and/or modify it
75 under the same terms as Perl itself.
76
77SEE ALSO
78 HTML::Parser http://www.nttdocomo.co.jp/p_s/imode/tag/lineup.html
79 (Japanese)
80
81