NAME
HTTP::Headers::UserAgent - Class encapsulating the HTTP User-Agent header
SYNOPSIS
use HTTP::Headers::UserAgent;
HTTP::Headers::UserAgent->DumpFile( $fh );
$user_agent = new HTTP::Headers::UserAgent $ENV{HTTP_USER_AGENT};
$user-agent->string( $ENV{HTTP_USER_AGENT} );
$string = $user_agent->string;
$platform = $user_agent->platform;
$os = $user_agent->os;
( $browser, $version ) = $user_agent->browser;
#backwards-compatibility with HTTP::Headers::UserAgent 1.00
$old_platform = HTTP::Headers::UserAgent::GetPlatform $ENV{HTTP_USER_AGENT};
DESCRIPTION
The HTTP::Headers::UserAgent class represents User-Agent HTTP headers.
This is version 3.00 of the HTTP::Headers::UserAgent class. It is now depriciated, and the code is a wrapper around the more well-maintained HTTP::BrowserDetect module. You are advised to switch to HTTP::BrowswerDetect. While the interface provides backward-compatibility with version 1.00, it is not based on the 1.00 code.
METHODS
- DumpFile
-
No-op compatibility method.
- new HTTP_USER_AGENT
-
Creates a new HTTP::Headers::UserAgent object. Takes the HTTP_USER_AGENT string as a parameter.
- string [ HTTP_USER_AGENT ]
-
If a parameter is given, sets the user-agent string.
Returns the user-agent as an unprocessed string.
- platform
-
Tries to guess the platform. Returns ia32, ppc, alpha, hppa, mips, sparc, or unknown.
ia32 Intel archetecure, 32-bit (x86) ppc PowerPC alpha DEC (now Compaq) Alpha hppa HP mips SGI MIPS sparc Sun Sparc
This is the only function which is not yet implemented as a wrapper around an equivalent function in HTTP::BrowserDetect.
- os
-
Tries to guess the operating system. Returns irix, win16, win95, win98, winnt, win32 (Windows 95/98/NT/?), macos, osf1, linux, solaris, sunos, bsdi, os2, or unknown.
This is now a wrapper around HTTP::BrowserDetect methods. Using HTTP::BrowserDetect natively offers a better interface to OS detection and is recommended.
- browser
-
Returns a list consisting of the browser name and version. Possible browser names are:
Netscape, IE, Opera, Lynx, WebTV, AOL Browser, or Unknown
This is now a wrapper around HTTP::BrowserDetect::browser_string
BACKWARDS COMPATIBILITY
For backwards compatibility with HTTP::Headers::UserAgent 1.00, a GetPlatform subroutine is provided.
- GetPlatform HTTP_USER_AGENT
-
Returns Win95, Win98, WinNT, UNIX, MAC, Win3x, OS2, Linux, or undef.
In some cases ( `Win32', `Windows CE' ) where HTTP::Headers::UserAgent 1.00 would have returned `Win95', will return undef instead.
Will return `UNIX' for some cases where HTTP::Headers::UserAgent would have returned undef.
AUTHOR
Ivan Kohler <ivan-useragent@420.am>
Portions of this software were originally taken from the Bugzilla Bug Tracking system <http://www.mozilla.org/bugs/>, and are reused here with permission of the original author, Terry Weissman <terry@mozilla.org>.
COPYRIGHT
Copyright (c) 2001 Ivan Kohler. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
BUGS
Really you should just switch over to the more well-maintained HTTP::BrowserDetect, which this module is now just a wrapper around.
SEE ALSO
perl(1), HTTP::Headers, HTTP::BrowserDetect