Mobile::UserAgent

Mobile::UserAgent is a mobile user agent string parsing class.
Download

Mobile::UserAgent Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Craig Manley
  • Publisher web site:
  • http://search.cpan.org/~cmanley/SMS-Ringtone-RTTTL-Parser-0.07/lib/SMS/Ringtone/RTTTL/Parser.pm

Mobile::UserAgent Tags


Mobile::UserAgent Description

Mobile::UserAgent is a mobile user agent string parsing class. Mobile::UserAgent is a mobile user agent string parsing class.SYNOPSIS ### Print the information parsed from a user-agent string: use Mobile::UserAgent; my $useragent = 'Nokia6600/1.0 (4.09.1) SymbianOS/7.0s Series60/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0'; my $uaobj = new Mobile::UserAgent($useragent); if ($uaobj->success()) { print 'Vendor: ' . $uaobj->vendor() . "n"; print 'Model: ' . $uaobj->model() . "n"; print 'Version: ' . $uaobj->version() . "n"; print 'Series60: ' . $uaobj->isSeries60() . "n"; print 'Imode?: ' . $uaobj->isImode() . "n"; print 'Mozilla?: ' . $uaobj->isMozilla() . "n"; print 'Standard?: ' . $uaobj->isStandard() . "n"; print 'Rubbish?: ' . $uaobj->isRubbish() . "n"; } else { print "Not a mobile user-agent: $useragentn"; } ### Determine if the client is a mobile device. use Mobile::UserAgent (); use CGI (); # Check 1: (check if it sends a user-agent profile URL in it's headers) foreach my $name ('X_WAP_PROFILE','PROFILE','13_PROFILE','56_PROFILE') { if (exists($ENV{"HTTP_$name"})) { print "Client has a user-agent profile header, so it's probably a mobile device.n"; last; } } # Check 2: (check if it supports WML): my $q = new CGI(); if ($q->Accept('text/vnd.wap.wml') == 1) { print "Client supports WML so it's probably a mobile device.n"; } # Check 3: (check if this class can parse it) my $uaobj = new Mobile::UserAgent(); if ($uaobj->success()) { print "Client's user-agent could be parsed, so it's a mobile device.n"; }Parses a mobile user agent string into it's basic constituent parts, the most important being vendor and model.One reason for doing this would be to use this information to lookup vendor-model specific device characteristics in a database. You can use also use user agent profiles to do this (for which I've developed other classes), but not all mobile phones have these, especially the older types. Another reason would be to detect if the visiting client is a mobile handset.Only real mobile user-agent strings can be parsed succesfully by this class. Most WAP emulators are not supported because they usually don't use the same user-agent strings as the devices they emulate. Requirements: · Perl


Mobile::UserAgent Related Software