
Mobile::WURFL::Resource - WURFL Resource

#!/usr/bin/perl
# use this to bootstrap a WURFL database
use Mobile::WURFL::Resource;
my $resource = Mobile::WURFL::Resource->new;
print "where are our BDBs? ", $resource->wurfl_bdb, "\n";
print "where is our WURFL XML file? ", $resource->wurfl_xml, "\n";
if (not -e $xml_file) {
$resource->update;
die sprintf "%s", if $resource->error;
}
$resource->parse;
die sprintf( "parse error: %s\n", $resource->error_message) if $resource->error;
print join "\n -", 'attributes:', $resource->attribute_fields, "\n";
print join "\n -", 'capabilities:', $resource->capability_fields, "\n";
print "saved? ", $resource->create_bdb, "\n";

This class provides some methods to retrieve a WURFL Resource, a simple XML file, from a remote server, parse and save it into a BerkeleyDB for later uses.
newAccepts a reference to a hash with following parameters:
updatetries to retrieve a new copy of the remote resource file; sets error as needed.
errortrue if some error occurred.
error_messagea possibly meaningful message explaining what happened.
parseparse the resource pointed by wurfl_xml; sets error as needed.
parsedtrue if some data was parsed .
create_bdbsaves parsed informations into some BerkeleyDB archives.

Use eval {} inside create_bdb to intercept fatal errors and set an error message.

Mention other useful documentation such as the documentation of related modules or operating system documentation (such as man pages in UNIX), or any relevant external documentation such as RFCs or standards.
If you have a mailing list set up for your module, mention it here.
If you have a web site set up for your module, mention it here.

A. U. Thor, <ws-vas@>

Copyright (C) 2005 by A. U. Thor
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.