Path: usenet.cise.ufl.edu!newsfeeds.nerdc.ufl.edu!headwall.stanford.edu!newsfeed.stanford.edu!cyclone.bc.net!news.maxwell.syr.edu!newsfeed.corridex.com!nntp2.savvis.net!inetarena.com!not-for-mail
From: [email protected] (Ivan Kohler)
Newsgroups: comp.lang.perl.announce,comp.lang.perl.modules
Subject: [New Maintainer and Version] HTTP::Headers::UserAgent
Followup-To: comp.lang.perl.modules
Date: 30 Aug 1999 17:53:15 GMT
Organization: Posted via Supernews, http://www.supernews.com
Lines: 197
Approved: [email protected] (comp.lang.perl.announce)
Message-ID: <[email protected]>
NNTP-Posting-Host: halfdome.holdit.com
Keywords: perl module HTTP User-Agent
X-Disclaimer: The "Approved" header verifies header information for article transmission and does not imply approval of content.
Xref: usenet.cise.ufl.edu comp.lang.perl.announce:349 comp.lang.perl.modules:13135

HTTP::Headers::UserAgent v2.00

has been uploaded to CPAN, and can also be downloaded from
<http:/www.sisd.com/useragent>.

This is a class that deals with the HTTP User-Agent header.  It will parse
the header, and (hopefully) report the correct platform, operating system,
browser, and browser version.

This is version 2.00 of the HTTP::Headers::UserAgent class.  While the
interface provides backward-compatibility with version 1.00, it is not based
on the 1.00 code.

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 <[email protected]>.

DLSI status is adpO or adph, depending on whether you count the depriciated
1.00 interface.  I am unsure if I should send that to someone?


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;

        $bugzilla_platform = $user_agent->bugzilla_platform;

        $os = $user_agent->os;

        $bugzilla_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_AG
ENT};


DESCRIPTION
      The HTTP::Headers::UserAgent class represents User-Agent
      HTTP headers.

      This is version 2.00 of the HTTP::Headers::UserAgent
      class.  While the interface provides backward-
      compatibility with version 1.00, it is not based on the
      1.00 code.

METHODS
      DumpFile FILEHANDLE
          Class method - pass an open filehandle to this method,
          and all unparsable user-agent strings will be written
          to this filehandle.

          This will be triggered when you actually call the
          platform, os or browser methods.

          Pass the undefined value to disable this behavior.

      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


      bugzlla_platform
          Same as the platform method, with the following
          translations (for bugzilla compatbility):

            ia32    PC
            ppc     Macintosh
            alpha   DEC
            hppa    HP
            mips    SGI
            sparc   Sun
            unknown Other


      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.

      bugzilla_os
          Same as the os method, with the following translations
          (for bugzilla):

            irix     IRIX
            macos    Mac System 8.5
            osf1     OSF/1
            linux    Linux
            solaris  Soalris
            sunos    SunOS
            bsdi     BSDI
            win16    Windows 3.1
            win95    Windows 95
            win98    Windows 95
            winnt    Windows NT
            win32    Windows 95
            os2      other
            unknown  other

      browser
          Returns a list consisting of the browser name and
          version.  Possible browser names are:

          Netscape, IE, Opera, Lynx, Mozilla, Emacs-W3, or
          Unknown

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 <[email protected]>

      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
      <[email protected]>.

COPYRIGHT
      Copyright (c) 1999 iQualify, Inc.
      <http://www.iqualify.com/> All rights reserved.  This
      program is free software; you can redistribute it and/or
      modify it under the same terms as Perl itself.

BUGS
      Needs more testing, especially with less common
      platforms/OSs/browsers.  Help save the world!  Send
      unparsable user-agent headers (and the platform/OS/browser
      that generated them) to <[email protected]>.  Please
      be sure you have the latest version of
      HTTP::Headers::UserAgent first!

      bugzilla_os returns "Windows 95" instead of "Windows 98",
      because stock Bugzilla doesn't have a "Windows 98" choice.
      You can work around this by setting
      $HTTP::Headers::UserAgent::bugzilla_os{win98} = "Windows
      98";

      The bugzilla_* methods are a kludge and should probably
      replaced with a general method for doing arbitrary
      translation tables.

      The version number is 2.00 rather than the more
      traditional 0.01, because the previous
      HTTP::Headers::UserAgent module had version number 1.00.

SEE ALSO
      perl(1), the HTTP::Headers manpage

--
Ivan Kohler <[email protected]> - finger for PGP key - <com.dsis@navi> Relhok Navi
Open-source billing and administration for ISPs - http://www.sisd.com/freeside
20 4,16 * * * saytime # please don't be surprised if you find me dreaming too