The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Duadua - Detect User-Agent, do up again!

SYNOPSIS

    use Duadua;

    my $ua = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';

    my $d = Duadua->new($ua);
    $d->is_bot
        and say $d->name; # Googlebot

Or call as a function to parse immediately

    my $d = Duadua->parse($ua);
    $d->is_bot
        and say $d->name; # Googlebot

If you would like to parse many times, then you can use reparse method. It's fast.

    my $d = Duadua->new;
    for my $ua (@ua_list) {
        my $result = $d->reparse($ua);
        $result->is_bot
            and say $result->name;
    }

DESCRIPTION

Duadua is a User-Agent detector.

METHODS

new($user_agent_string, $options_hash)

constructor

Constructor options

version => 1 or 0

If you set the true value to version, then you can get version string. (By default, don't get version)

skip => ['ParserClass']

If you set the array to skip, then you can skip detect logic by specific classes.

NOTE that ParserClass is case sensitive, and it might be going to change results.

parse

Parse User-Agent string

reparse($ua)

Parse User-Agent string by same instance without new

GETTERS

ua

Return raw User-Agent string

name

Get User-Agent name

is_bot

Return true value if the User-Agent is bot.

is_ios

Return true value if the User-Agent is iOS.

is_android

Return true value if the User-Agent is Android.

is_linux

Return true value if the User-Agent is Linux.

is_windows

Return true value if the User-Agent is Windows.

is_chromeos

Return true value if the User-Agent is ChromeOS.

opt_version

Return version option value. If it's true value, then parse to get User Agent version also.

parsers

The list of User Agent Parser

REPOSITORY

Duadua is hosted on github: http://github.com/bayashi/Duadua

I appreciate any feedback :D

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

LICENSE

Duadua is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. (Note that, unlike the Artistic License 1.0, version 2.0 is GPL compatible by itself, hence there is no benefit to having an Artistic 2.0 / GPL disjunction.) See the file LICENSE for details.