AWStats and Perl 5.14

2013-03-06
2013-05-08
  • I have seen various posts reporting problems related to using AWStats using a recent version of Perl. My installation of AWStats now seems to work using Perl v5.14.2 in a cygwin environment. Maybe there is someone who wants to know how I did this:

    1) Download the current version of AWStats from the CVS repository .

    For more information see http://www.awstats.org/, Section "For developer who wants to work on AWStats project"

    2) Add a caret character ("^") in the regular expression that is contained in the UnCompileRegex-subroutine. For details see the following output of cvs diff:

    $ cvs diff -bc awstats.pl
    Index: awstats.pl
    ===================================================================
    RCS file: /cvsroot/awstats/awstats/wwwroot/cgi-bin/awstats.pl,v
    retrieving revision 1.987
    diff -b -c -r1.987 awstats.pl
    *** awstats.pl  27 Feb 2013 16:04:57 -0000      1.987
    --- awstats.pl  6 Mar 2013 17:43:27 -0000
    ***************
    *** 7817,7823 ****
      # Return:             standardregex
      #------------------------------------------------------------------------------
      sub UnCompileRegex {
    !       shift =~ /\(\?[-\w]*:(.*)\)/;
            return ;
      }
    
    --- 7817,7823 ----
      # Return:             standardregex
      #------------------------------------------------------------------------------
      sub UnCompileRegex {
    !       shift =~ /\(\?[-\w^]*:(.*)\)/;
            return ;
      }
    

    Without this change my configuration caused AWStats to crash. After the change I got essentially the same results as with another installation that uses Perl v5.8.7. The resulting database files differed as they reported a different path to the config file, different time of analyis and the like. The results of the analysis were the same, however.

    Background: In Perl 5.14 the format the string representation of regular expressions changed (see http://perldoc.perl.org/perl5140delta.html#Regular-Expressions for more information): It will contain a caret sign at a position where the subroutine UnCompileRegex does not expect one. Therefore the match will fail or work incorrectly, and this error causes various symptoms.

    For AWStats Version 6.95 there is a bug report ("#900 regex parser does not understand perl 5.14 caret ") that contains a patch that addresses the same problem: https://sourceforge.net/p/awstats/bugs/900/

    Hope this helps

    Albrecht Müller

     
  • I think this problem has been fixed in version 7.1.1. See awstats_changelog.txt ("Fix problems with Perl 5.14").