GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mobile::UserAgentFactory(3) User Contributed Perl Documentation Mobile::UserAgentFactory(3)

Mobile::UserAgentFactory - Instantiates and caches Mobile::UserAgent objects.

 use Mobile::UserAgentFactory;
 my $factory = Mobile::UserAgentFactory->instance();

 # Get Mobile::UserAgent object using a useragent string (preferred):
 my $mua = $factory->getMobileUserAgent($ENV{'HTTP_USER_AGENT'});

 # Get Mobile::UserAgent object by letting the factory look for the useragent in
 # the HTTP_* environment variables.
 my $mua = $factory->getMobileUserAgent();

 if (defined($mua) && $mua->success()) {
   printf("Vendor: %s\nModel: %s\n", $mua->vendor(), $mua->model());
 }

Factory class for the instantiating and caching of Mobile::UserAgent objects. Caching occurs in this class itself.

$factory = Mobile::UserAgentFactory->instance($options_hash_ref)
This class method returns a Mobile::UserAgentFactory instance.

The optional $options_hash_ref supports the following options:

  cache_expires_in - The expiration time for unused Mobile::UserAgent objects in the internal cache. Defaults to 86400 (1 day) if not explicitly set.

  cache_purge_interval - Sets the internal cache purge interval. Defaults to 3600 (1 hour).

  cache_max_age - Sets the maximum time Mobile::UserAgent objects may remain in the internal cache. Defaults to 604800 (1 week).

  cache_max_objects - Sets the maximum number of objects to store in the internal cache. Defaults to 1000.
    

The public object methods available are:
$uaprof->getMobileUserAgent([$useragent | $cgi], [$options])
Returns a matching Mobile::UserAgent object or undef if none could be found.

You can optionally pass either a $useragent string or a CGI object as first parameter. If you pass neither, then this method will attempt to use the HTTP_USER_AGENT environment variable.

$options is an optional hash ref which may contain the following keys:

  debug - Set it to a true value to see what's going on.
    

Mobile::UserAgent.

Copyright (C) 2005 Craig Manley. All rights reserved. You may not redistribute, sell, modify, copy, claim ownership of, nor incorporate this software into any other software without the prior written permission of the author. This software may only be used in applications developed by the author.

Craig Manley
2005-10-14 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.