#!/usr/bin/perl -w use strict; use HTTP::Browscap; # send correct HTTP header print "Content-type: text/plain; charset=iso-8859-2\n\n"; # initialize browscap.ini database my $browscap=new HTTP::Browscap('browscap.ini'); $browscap || die("Browscap.ini did nto initialize: $!"); # get agent identification string my $agent=$ENV{'HTTP_USER_AGENT'}; $agent || die("Cannot get user agent identification string"); print "Your user agent: $agent\n\n"; # get agent information from database my $browser=$browscap->identify($agent); $browser || die("Your browser does not match any record in our database"); # print agent information foreach my $variable (keys %{$browser}) { # do not print ugly internal variables defined($HTTP::Browscap::variables{$variable}) || next; # print variables print sprintf("%30s", $HTTP::Browscap::variables{$variable}). ': '. $browser->{$variable}. "\n"; }