[Melbourne-pm] mod_perl quirks

Mathew Robertson mathew.blair.robertson at gmail.com
Thu Jan 8 14:44:32 PST 2015

Hi PM,

During the mod-perl vs other frameworks discussion, I remembered one
particular annoyance of mod-perl...  all the mod-perl error-log messages
saying stuff like:

  Constant subroutine redefined
  PV = SV

I have scoured the web trying to determine what/where this comes from -
eventually identifying the problem as "yeah Mod-Perl does that... they are
only warnings so just ignore them". But alas that just fills up the Apache
errorlog.  And no amount of Apache error-level settings changed this

So eventually I came up with this...  any other solutions?


In apache2.conf :

   ErrorLog "||/usr/local/bin/apache_log_filter.pl

In /usr/local/bin/apache_log_filter.pl :

use strict;
use warnings FATAL => 'all';
use utf8;

my $logfile = $ARGV[0] or die "Missing logfile name";
open(LOG,">>",$logfile) or die "Failed opening: $logfile";
select((select(LOG), $|=1)[0]);
my $last = '';
my $catch_at;
while(<STDIN>) {
  $last = $_ unless /^ at .* line \d+/;
  if (/^Prototype mismatch/) {
    $catch_at = 1;
  next if /^Constant subroutine/;
  next if /^SV = /;
  next if /^  REFCNT /;
  next if /^  FLAGS /;
  next if /^  PV /;
  next if /^PV\(0x.*\) at 0x/;
  if (/^ at .* line \d+/) {
    if ($catch_at) {
      $catch_at = 0;
    print LOG $last;
    print LOG $_;
  print LOG $_;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20150109/e3816350/attachment.html>

More information about the Melbourne-pm mailing list