Mobile::WURFL::Resource - WURFL Resource


Mobile-WURFL documentation  | view source Contained in the Mobile-WURFL distribution.

Index


NAME

Top

Mobile::WURFL::Resource - WURFL Resource

SYNOPSIS

Top

  #!/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";

DESCRIPTION

Top

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.

new

Accepts a reference to a hash with following parameters:

wurfl_uri

...

wurfl_xml

...

wurfl_bdb

...

update

tries to retrieve a new copy of the remote resource file; sets error as needed.

error

true if some error occurred.

error_message

a possibly meaningful message explaining what happened.

parse

parse the resource pointed by wurfl_xml; sets error as needed.

parsed

true if some data was parsed .

create_bdb

saves parsed informations into some BerkeleyDB archives.

TO DO

Top

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

SEE ALSO

Top

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.

AUTHOR

Top

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

COPYRIGHT AND LICENSE

Top


Mobile-WURFL documentation  | view source Contained in the Mobile-WURFL distribution.