Valerio VALDEZ Paolini > Mobile-WURFL-0.02 > Mobile::WURFL::Resource

Download:
Mobile-WURFL-0.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Mobile::WURFL::Resource - WURFL Resource

SYNOPSIS ^

  #!/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 ^

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 ^

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

SEE ALSO ^

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 ^

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

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: