HTTP::UA::Parser - Perl User Agent Parser
Perl port of the ua-parser project - https://github.com/tobie/ua-parser.
use HTTP::UA::Parser; my $r = HTTP::UA::Parser->new(); print $r->ua->toString(); # -> "Safari 5.0.1" print $r->ua->toVersionString(); # -> "5.0.1" print $r->ua->family; # -> "Safari" print $r->ua->major; # -> "5" print $r->ua->minor; # -> "0" print $r->ua->patch; # -> "1" print $r->os->toString(); # -> "iOS 5.1" print $r->os->toVersionString(); # -> "5.1" print $r->os->family # -> "iOS" print $r->os->major; # -> "5" print $r->os->minor; # -> "1" print $r->os->patch; # -> undef print $r->device->family; # -> "iPhone"
Accepts a user agent string to parse, leave empty to parse caller user agent.
Accepts a new user agent to parse
Parses browser part of the user agent
Parsers operating system part of the user agent
Parses device part of the user agent
Methods to print results as strings
returns os / ua name
returns full version number of os/browser
returns family name of os/browser/device
returns version's major part of os/browser
returns version's minor part of os/browser
returns versions patch part of os/browser
returns version patch minor part of os/browser
From CPAN shell simply type
% perl -MCPAN -e 'install HTTP::UA::Parser'
Or from your local download, unpack and:
% perl Makefile.PL % make && make test
Then install:
% make install
Mamod A. Mehyar, <mamod.mehyar@gmail.com>
Copyright (C) 2013 by Mamod A. Mehyar
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.
To install HTTP::UA::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::UA::Parser
CPAN shell
perl -MCPAN -e shell install HTTP::UA::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.