en en  

Version 1.1 with some bugfixes and updates has been released.


Initial version 1.0 has been released.

This module provides an object HTTP::Browscap, which can get a lot of information about web browser comparing its User-Agent identification to a special database in browscap.ini file. If calling a Perl script via CGI, the browser identification string can be found in environmental variable $ENV{'HTTP_USER_AGENT'}.

You need just two things to let this software run:

  • Perl >= 5.6.0 (older versions should work too)
  • Browscap database - the browscap.ini file, for example at garrykeith.com

This module is not listed in official CPAN list of Perl modules, because there already exists a HTTP::Browscap module. You may use whichever you want. You can also try the module on demo page with source code example.

This program is free software, distribute it or modify it under the terms as Perl itself.

Follow these few steps as the system superuser. Running the test is optional:

# tar xzf HTTP-Browscap-x.y.tar.gz
# cd HTTP-Browscap-x.y
# perl Makefile.PL
# make
# make test
# make install

The package manpage contains all important informatoin about how to use it, so please refer to that page. Of course, HTML version is available.

Select version:

Module version:
Direct link:

Your user agent: CCBot/2.0 (https://commoncrawl.org/faq/)

Browser name:"Default Browser"
Parent browser:"DefaultProperties"

Example script source:

#!/usr/bin/perl -w

use strict;
use HTTP::Browscap;

# 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 $HTTP::Browscap::variables{$variable}).': '.$browser->{$variable}."\n";

There are no known bugs at this moment. If you knouw about any, please let me know at mccohy@kyberdigi.cz.


Josh Rosenbaum reported about bad handling of regular expression in browser name. If there were some '+' characters in browser name in browscap.ini file, the running program could have died with some Perl syntax error or any similar error. This bug has been (probably) fixed in version 1.1. Please note, that there is a possibility that this bug will appear in next versions, because I simple cannot know before, which bad characters or sets of characters will appear in future versions of browscap.ini.


Version 1.1

  • added browser variables width, height and javaappletsframes
  • bugfix: allow '+' in agent identification strings (this character is being replaced with a space, thanks to Josh Rosenbaum for bugreport)
  • bugfix: allow spaces in variable names in browscap.ini
  • bugfix: allow case insensitive variable names in browscap.ini
  • fixed typo: in documentation in example $browser->{'browser'} says browser name, not previously shown $browser->{'name'}
  • update of module documentation
  • change of project homepage in module documentation


Initial release 1.0