CGI-WML
view release on metacpan or search on metacpan
An image can be created with the following attributes:
alt Text to display in case the image is not displayed
align can be top, middle, bottom
src The absolute or relative URI to the image
localsrc a variable (set using the setvar tag) that refers to an image
this attribute takes precedence over the B<src> tag
vspace
hspace amount of white space to inserted to the left and right
of the image [hspace] or above and below the image [vspace]
height
width These attributes are a hint to the user agent to leave space
for the image while the page is rendering the page. The
user agent may ignore the attributes. If the number length
is passed as a percent the resulting image size will be
relative to the amount of available space, not the image size.
my $img = $query->img(
-src => '/icons/blue_boy.wbmp',
-alt => 'Blue Boy',
-localsrc => '$var',
-vspace => '25',
-hspace => '30
-align => 'bottom',
-height => '15',
-width => '10');
I<NOTE> the B<localsrc> element, and formatting elements are not supported
consistently by the current generation of terminals, however they B<should>
simply ignore the attributes they do not understand.
=head2 Dial Tags
When using cell phones in WAP you can make calls. When a dial tag is
selected the phone drops out of the WAP stack and into what ever is the
protocol used for phone calls. At the conclusion of the call the phone
I<should> return to the WAP stack in the same place that you linked to
the phone number.
The tag looks much like a regular link, but has some special syntax.
$query->dialtag(-label =>"Joe's Pizza",
-number=>"12125551212");
The recieving terminal must support WTAI for this link to work.
=head1 WML SHORTCUTS
I<p> I<b> I<br> I<table> etc. etc. Just like the original CGI.pm, this
module includes functions for creating correct WML by calling methods of
a query object.
WML Shortcuts may be called in two ways;
With a single parameter, which will be the content of the tag, for
example;
Perl code WML Result
--------------------- ---------------------
$query->b("Bold text); <b>bold</b>
$query->p("Hello"); <p>Hello</p>
$query->p($query->b("Hello")); <p><b>Hello</b></p>
$query->br(); <br/> # "No-close" tags are
# automatically dealt with
Alternatively, they can be called with a list of arguments, specifying
content and attibutes.
Perl code WML Result
--------------------- ---------------------
$query->p(-align=>"left", <p align="left">Hi there</p>
-content=>"Hi there");
When being called with the second syntax, the 'content' parameter
specifies the content of tags.
All WML 1.1 tags are available via this method.
=head1 COMPILING WML DECKS
$query->wml_to_wmlc(-wml=>$buffer,
-errorcontext=>2); # default 0
A WML to WBXML converter/compiler is included for convinience purposes,
although it is not intended to replace the compiler on the WAP
gateway it may prove useful, for example measuring what the compiled
document size will be.
$size = length($query->wml_to_wmlc(-wml=>$wml,
-errorcontext=>0));
=over 4
I<NOTE> WBXML string tables are used to compress the document size down as small
as possible, giving excellent document size performance. Because of this
though, the size returned by the function may be smaller than the size
of the WBXML document created by the WAP gateway. Turning this feature
off will be an option in future releases.
=back
The function takes two arguments, a buffer of textual WML and an optional
argument specifiying that should the XML parser fail then X many lines of
the buffer before and after the point where the error occured will be printed
to show the context of the error.
=head2 ERRORCONTEXT
I<WARNING> Setting this to any non-zero value will cause your program to
exit if the routine is passed WML which is not "well formed" this is due
to the fact that XML::Parser calls die() upon such events.
If you wish to test wether a WML document is well formed, then set this
value to zero and check the return value of the function. The function
returns undef upon failiure and issues a warning, anything other than
undef indicates success.
=head1 HTML TO WML CONVERSION
( run in 1.411 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )