HTTP-UserAgentString-Parser

 view release on metacpan or  search on metacpan

lib/HTTP/UserAgentString/Robot.pm  view on Meta::CPAN

Web page for the robot

=item $robot->company()

Name of the company that develops the robot 

=item $robot->company_url()

URL of the company that develops the robot

=item $robot->ico()

PNG icon for the robot that can be obtained from http://user-agent-string.info/pub/img/ua/

=item $robot->info_url()

Web page in http://user-agent-string.info/ that provides information on the robot

=item $robot->os

If defined, L<HTTP::UserAgentString::OS> object representing the operating system where the robot is
running.

=back

=head1 SEE ALSO

L<HTTP::UserAgentString::OS> for the class representing operating systems, and L<UAS::Browser> 
for browsers.

=head1 COPYRIGHT

 Copyright (c) 2011 Nicolas Moldavsky (http://www.e-planning.net/)
 This library is released under LGPL V3

=cut

use strict;
use base qw(HTTP::UserAgentString::Sys);

my @KEYS = qw(uastring family name url company company_url ico os_id info_url);

sub new($$;$) {
	my ($pkg, $data, $os) = @_;
	
	my $h = {};
	for (my $i = 0; $i < scalar(@KEYS); $i++) {
		my $val = $data->[$i];
		if (defined($val) and (length($val) > 0)) {
			$h->{$KEYS[$i]} = $val;
		}
	}
	$h->{os} = $os;
	return bless($h, $pkg);
}


sub uastring($) { $_[0]->{uastring} }
sub family($) { $_[0]->{family} }
sub info_url($) { $_[0]->{info_url} }
sub os($) { $_[0]->{os} }
sub os_id($) { $_[0]->{os_id} }

sub isRobot($) { 1 }

1;



( run in 0.315 second using v1.01-cache-2.11-cpan-5623c5533a1 )