Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    Mobile::UserAgent 1.05

    Download button

    No screenshots available
    Downloads: 637  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Craig Manley | More programs
    Perl Artistic License / FREE
    March 22nd, 2007, 23:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    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.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    mobile user agent | string parsig class | Perl module | Mobile::UserAgent | mobile | user

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM