GithubHelp home page GithubHelp logo

uap-perl's Introduction

NAME

HTTP::UA::Parser - Perl User Agent Parser

DESCRIPTION

Perl port of the ua-parser project - https://github.com/ua-parser

SYNOPSIS

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"
print $r->device->brand;          # -> "Apple"
print $r->device->model;          # -> "iPhone"

Methods

new()

Accepts a user agent string to parse, leave empty to parse caller user agent.

parse()

Accepts a new user agent to parse

ua()

Parses browser part of the user agent

os()

Parsers operating system part of the user agent

device()

Parses device part of the user agent

Stringify Methods

Methods to print results as strings

toString()

returns os / ua name

toVersionString()

returns full version number of os/browser

family()

returns family name of os/browser/device

major()

returns version's major part of os/browser

minor()

returns version's minor part of os/browser

patch()

returns versions patch part of os/browser

patchMinor()

returns version patch minor part of os/browser

brand()

returns brand name of device

model()

returns model name of device

INSTALLATION

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

COMMAND LINE

To update regexes.yaml file from command line

% ua_parser -u

To parse some user agent from command line

% ua_parser -p "some user agent"

Help usage

% ua_parser -h

AUTHOR

Mamod A. Mehyar, <[email protected]>

COPYRIGHT AND LICENSE

Copyright (C) 2020 by Mamod A. Mehyar & other contributors

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.

uap-perl's People

Contributors

mamod avatar commenthol avatar bluesmoon avatar tobie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.