Mobile::Libwurfl - Perl bindings to the commercial wurfl library (from ScientiaMobile)
use Wurfl; $wurfl = Wurfl->new(); ### # optionally you can set the engine mode or the cache_provider # (refer to libwurfl documentation for more details) $err = $wurfl->set_engine(WURFL_ENGINE_TARGET_HIGH_PERFORMANCE); if ($err != WURFL_OK) { die $wurfl->error_message; } $err = $wurfl->set_cache_provider(WURFL_CACHE_PROVIDER_DOUBLE_LRU, "10000,3000"); if ($err != WURFL_OK) { die $wurfl->error_message; } #### $wurfl->load("/usr/share/wurfl/wurfl.xml"); # you can also provide the database file directly to the constructor # (default engine mode and cache provider will be used) $wurfl = Wurfl->new("/usr/share/wurfl/wurfl.xml"); $device = $wurfl->lookup_useragent(USERAGENT); # get an hashref with all known capabilities $capabilities = $device->capabilities; # or access a specific capability directly $viewport_width = $device->get_capability('viewport_width'); All functions from libwurfl have been mapped, refer to the Mobile::Libwurfl::Device documentation for a list of methods
Perl bindings to the commercial C library to access wurfl databases
new ($dbfile)
Creates a new Wurfl object. if $dbfile is provided it will be immediately loaded using the default engine mode and cache provider
load ($dbfile)
Load the database file at the path pointed by $dbfile
lookup_useragent ($ua_string)
Returns a Mobile::Libwurfl::Device object representing the best match for the provided useragent string
get_device ($id)
Returns a new Mobile::Libwurfl::Device object for the provided device id (if any)
set_engine ($mode)
Sets the engine mode. This method can be called only before loading a database file. If called once a database file has been already loaded WURFL_ERROR_ALREADY_LOAD will be returned
Valid values for the $mode argument are : WURFL_ENGINE_TARGET_HIGH_ACCURACY and WURFL_ENGINE_TARGET_HIGH_ACCURACY
set_cache_provider ($provider, $config)
Sets and configure the cache provider. This method can be called only before loading a database file. If called once a database file has been already loaded WURFL_ERROR_ALREADY_LOAD will be returned
Valid values for the $mode argument are : WURFL_CACHE_PROVIDER_NONE, WURFL_CACHE_PROVIDER_LRU and WURFL_CACHE_PROVIDER_DOUBLE_LRU
Check libwurfl documnetation for further details on their meaning and what expected in the $config param.
error_message ()
has_error_message ()
clear_error_message ()
add_patch ($patch_file)
WURFL_CACHE_PROVIDER_DOUBLE_LRU WURFL_CACHE_PROVIDER_LRU WURFL_CACHE_PROVIDER_NONE WURFL_ENGINE_TARGET_HIGH_ACCURACY WURFL_ENGINE_TARGET_HIGH_PERFORMANCE WURFL_ERROR_ALREADY_LOAD WURFL_ERROR_CANT_LOAD_CAPABILITY_NOT_FOUND WURFL_ERROR_CANT_LOAD_VIRTUAL_CAPABILITY_NOT_FOUND WURFL_ERROR_CAPABILITY_GROUP_MISMATCH WURFL_ERROR_CAPABILITY_GROUP_NOT_FOUND WURFL_ERROR_CAPABILITY_NOT_FOUND WURFL_ERROR_DEVICE_ALREADY_DEFINED WURFL_ERROR_DEVICE_HIERARCHY_CIRCULAR_REFERENCE WURFL_ERROR_DEVICE_NOT_FOUND WURFL_ERROR_EMPTY_ID WURFL_ERROR_FILE_NOT_FOUND WURFL_ERROR_INPUT_OUTPUT_FAILURE WURFL_ERROR_INVALID_CAPABILITY_VALUE WURFL_ERROR_INVALID_HANDLE WURFL_ERROR_INVALID_PARAMETER WURFL_ERROR_UNEXPECTED_END_OF_FILE WURFL_ERROR_UNKNOWN WURFL_ERROR_USERAGENT_ALREADY_DEFINED WURFL_ERROR_VIRTUAL_CAPABILITY_NOT_FOUND WURFL_MATCH_TYPE_CACHED WURFL_MATCH_TYPE_CATCHALL WURFL_MATCH_TYPE_CONCLUSIVE WURFL_MATCH_TYPE_EXACT WURFL_MATCH_TYPE_HIGHPERFORMANCE WURFL_MATCH_TYPE_NONE WURFL_MATCH_TYPE_RECOVERY WURFL_OK
Mobile::Libwurfl::Device
Andrea Guzzo, <xant@xant.net>
Copyright (C) 2013 by Andrea Guzzo
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
To install Mobile::Libwurfl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mobile::Libwurfl
CPAN shell
perl -MCPAN -e shell install Mobile::Libwurfl
For more information on module installation, please visit the detailed CPAN module installation guide.