r15984 - in /trunk/libapache-dbilogger-perl: DBILogger.pm debian/changelog debian/control debian/patches/ debian/patches/apache2.patch debian/patches/series debian/rules

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Fri Feb 29 20:08:42 UTC 2008


Author: gregoa-guest
Date: Fri Feb 29 20:08:41 2008
New Revision: 15984

URL: http://svn.debian.org/wsvn/?sc=1&rev=15984
Log:
Split out Gunnar's fixes for Apache 2.x into apache2.patch; add quilt
  framework.

Added:
    trunk/libapache-dbilogger-perl/debian/patches/
    trunk/libapache-dbilogger-perl/debian/patches/apache2.patch
    trunk/libapache-dbilogger-perl/debian/patches/series
Modified:
    trunk/libapache-dbilogger-perl/DBILogger.pm
    trunk/libapache-dbilogger-perl/debian/changelog
    trunk/libapache-dbilogger-perl/debian/control
    trunk/libapache-dbilogger-perl/debian/rules

Modified: trunk/libapache-dbilogger-perl/DBILogger.pm
URL: http://svn.debian.org/wsvn/trunk/libapache-dbilogger-perl/DBILogger.pm?rev=15984&op=diff
==============================================================================
--- trunk/libapache-dbilogger-perl/DBILogger.pm (original)
+++ trunk/libapache-dbilogger-perl/DBILogger.pm Fri Feb 29 20:08:41 2008
@@ -2,25 +2,7 @@
 
 require 5.004;
 use strict;
-# use Apache::Constants qw( :common );
-# In order to make this module compatible with either Apache 1.3.x or 2.2.x, 
-# for which mod_perl has slightly different APIs, this BEGIN block serves the 
-# same purpose as the previous 'use Apache::Constants qw(:common)' statement.
-my $modperl2;
-BEGIN {
-    eval "use Apache::Constants qw(:common);";
-    if ($@) {
-        eval "use Apache2::Const qw(:common);
-              use APR::Pool; 
-              use APR::Table; 
-              use Apache2::Connection; 
-              use APR::SockAddr;";
-	$modperl2 = 1;
-	if ($@) {
-            die "Not under Apache, not under Apache2?\n$@";
-        }
-    }
-}
+use Apache::Constants qw( :common );
 use DBI;
 use Date::Format;
 
@@ -43,12 +25,30 @@
 }
 
 sub logger {
-        my $r = _get_req(shift);
+	my $r = shift->last;
 
 	my $s = $r->server;
 	my $c = $r->connection;
 
-	my %data = _get_data($r);
+	my %data = (
+		    'server'	=> $s->server_hostname,
+		    'bytes'     => $r->bytes_sent,
+		    'filename'	=> $r->filename || '',
+		    'remotehost'=> $c->remote_host || '',
+		    'remoteip'  => $c->remote_ip || '',
+		    'status'    => $r->status || '',
+		    'urlpath'	=> $r->uri || '',
+		    'referer'	=> $r->header_in("Referer") || '',	
+		    'useragent'	=> $r->header_in('User-Agent') || '',
+		    'timeserved'=> time2str("%Y-%m-%d %X", time),
+		    'contenttype' => $r->content_type || ''
+	);
+
+	if (my $user = $c->user) {
+		$data{user} = $user;
+	}
+
+	$data{usertrack} = $r->notes('cookie') || '';
 
 	my $dbh = DBI->connect($r->dir_config("DBILogger_data_source"), $r->dir_config("DBILogger_username"), $r->dir_config("DBILogger_password"));
   
@@ -57,12 +57,16 @@
   		return DECLINED;
   	}
   	
+  	my @valueslist;
+  	
+  	foreach (keys %data) {
+		$data{$_} = $dbh->quote($data{$_});
+		push @valueslist, $data{$_};
+	}
+
 	my $table = $r->dir_config("DBILogger_table") || 'requests';
 
-        my @columns = map($dbh->quote_identifier($_), keys   %data);
-        my @values  = map($dbh->quote($_),            values %data);
-        
-	my $statement = "INSERT INTO $table (" . join(', ', @columns) . ") VALUES (" . join(', ', @values ) . ")";
+	my $statement = "insert into $table (". join(',', keys %data) .") VALUES (". join(',', @valueslist) .")";
 
 	my $tries = 0;
 	
@@ -94,73 +98,8 @@
 # #perl pun: <q[merlyn]> windows is for users who can't handle the power of the mac.
 
 sub handler { 
-        _register_logger(shift);
-}
-
-############################################################
-# Multi-API compatibility functions follow
-#
-# _register_logger, _get_req and _get_data should take care of handling the
-# incompatibility between the mod_perl 1.x and 2.x APIs. They should do exactly
-# the same, although in a different way; they are based on
-# http://perl.apache.org/docs/2.0/user/porting/compat.html
-#
-# For any bugs regarding this code, please contact Gunnar Wolf 
-# <gwolf at debian.org>.
-sub _register_logger {
-        my $r = shift;
-	if ($modperl2) {
-	        $r->pool->cleanup_register(\&logger, $r);
-	} else {
-		$r->post_connection(\&logger);
-	}
+	shift->post_connection(\&logger);
 	return OK;
-}
-
-sub _get_req {
-        return $modperl2 ? shift : shift->last;
-}
-
-sub _get_data {
-        my ($r, $s, $c, %data);
-	$r = shift;
-	$s = $r->server;
-	$c = $r->connection;
-
-	if ($modperl2) {
-	        %data = (
-			 'server'	=> $s->server_hostname,
-			 'bytes'        => $r->bytes_sent,
-			 'filename'	=> $r->filename || '',
-			 'remotehost'   => $c->get_remote_host || '',
-			 'remoteip'     => $c->remote_addr->ip_get || '',
-			 'status'       => $r->status || '',
-			 'urlpath'	=> $r->uri || '',
-			 'referer'	=> $r->headers_in->{'Referer'} || '',
-			 'useragent'	=> $r->headers_in->{'User-Agent'} || '',
-			 'timeserved'   => time2str("%Y-%m-%d %X", time),
-			 'contenttype'  => $r->content_type || '',
-			 'user'         => $r->user() || '',
-			 'usertrack'    => $r->notes->get('cookie') || ''
-			 );
-	} else {
-	        %data = (
-			 'server'	=> $s->server_hostname,
-			 'bytes'        => $r->bytes_sent,
-			 'filename'	=> $r->filename || '',
-			 'remotehost'   => $c->remote_host || '',
-			 'remoteip'     => $c->remote_ip || '',
-			 'status'       => $r->status || '',
-			 'urlpath'	=> $r->uri || '',
-			 'referer'	=> $r->header_in("Referer") || '',	
-			 'useragent'	=> $r->header_in('User-Agent') || '',
-			 'timeserved'   => time2str("%Y-%m-%d %X", time),
-			 'contenttype'  => $r->content_type || '',
-			 'user'         => $c->user || '',
-			 'usertrack'    => $r->notes('cookie') || ''
-			 );
-	}
-	return %data;
 }
 
 1;
@@ -200,10 +139,6 @@
   KEY timeserved_idx (timeserved)
 );
 
-Please note that for some databases (notably, PostgreSQL) you will need to
-double-quote the user column name (that is, to specify it as C<"user" 
-varchar(15)>) in order for the database not to mistake it with a keyword.
-
 Its recommended that you include
 
 use Apache::DBI;
@@ -332,19 +267,6 @@
 You might get problems with Apache 1.2.x. (Not supporting
 post_connection?)
 
-=head1 MOD_PERL 2 SUPPORT
-
-The official version of this module, as Ask Bjoern Hansen last modified
-it, lacks support for the API changes introduced with Apache 2.x and
-the corresponding mod_perl 2.x - Of course, this is quite understandable
-as this module was last updated in 1998 ;-) But anyway, the module does its
-job still quite fine, and users still require its functionality.
-
-For any help requests regarding this module on Apache 2 systems, contact
-Gunnar Wolf <gwolf at debian.org> directly. If your system is based on Debian
-GNU/Linux, you can use the regular Debian bugtracking facilities, as the
-multi-API patch was introduced specifically for Debian.
-
 =head1 SUPPORT
 
 This module is supported via the mod_perl mailinglist

Modified: trunk/libapache-dbilogger-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libapache-dbilogger-perl/debian/changelog?rev=15984&op=diff
==============================================================================
--- trunk/libapache-dbilogger-perl/debian/changelog (original)
+++ trunk/libapache-dbilogger-perl/debian/changelog Fri Feb 29 20:08:41 2008
@@ -11,8 +11,10 @@
     - update with the help of dh-make-perl's templates
     - don't install README anymore, it's just the text version of the POD
       documentation
+  * Split out Gunnar's fixes for Apache 2.x into apache2.patch; add quilt
+    framework.
 
- -- gregor herrmann <gregor+debian at comodo.priv.at>  Fri, 29 Feb 2008 21:02:46 +0100
+ -- gregor herrmann <gregor+debian at comodo.priv.at>  Fri, 29 Feb 2008 21:06:14 +0100
 
 libapache-dbilogger-perl (0.93-10) unstable; urgency=low
 

Modified: trunk/libapache-dbilogger-perl/debian/control
URL: http://svn.debian.org/wsvn/trunk/libapache-dbilogger-perl/debian/control?rev=15984&op=diff
==============================================================================
--- trunk/libapache-dbilogger-perl/debian/control (original)
+++ trunk/libapache-dbilogger-perl/debian/control Fri Feb 29 20:08:41 2008
@@ -7,7 +7,7 @@
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libapache-dbilogger-perl/
 Priority: optional
 Section: perl
-Build-Depends: debhelper (>= 6)
+Build-Depends: debhelper (>= 6), quilt (>= 0.40)
 Build-Depends-Indep: perl (>= 5.6.0-17), libapache2-mod-perl2, libdbi-perl, libapache-dbi-perl, libtimedate-perl
 
 Package: libapache-dbilogger-perl

Added: trunk/libapache-dbilogger-perl/debian/patches/apache2.patch
URL: http://svn.debian.org/wsvn/trunk/libapache-dbilogger-perl/debian/patches/apache2.patch?rev=15984&op=file
==============================================================================
--- trunk/libapache-dbilogger-perl/debian/patches/apache2.patch (added)
+++ trunk/libapache-dbilogger-perl/debian/patches/apache2.patch Fri Feb 29 20:08:41 2008
@@ -1,0 +1,191 @@
+--- libapache-dbilogger-perl.orig/DBILogger.pm
++++ libapache-dbilogger-perl/DBILogger.pm
+@@ -2,7 +2,25 @@
+ 
+ require 5.004;
+ use strict;
+-use Apache::Constants qw( :common );
++# use Apache::Constants qw( :common );
++# In order to make this module compatible with either Apache 1.3.x or 2.2.x,
++# for which mod_perl has slightly different APIs, this BEGIN block serves the
++# same purpose as the previous 'use Apache::Constants qw(:common)' statement.
++my $modperl2;
++BEGIN {
++    eval "use Apache::Constants qw(:common);";
++    if ($@) {
++        eval "use Apache2::Const qw(:common);
++              use APR::Pool;
++              use APR::Table;
++              use Apache2::Connection;
++              use APR::SockAddr;";
++	$modperl2 = 1;
++	if ($@) {
++            die "Not under Apache, not under Apache2?\n$@";
++        }
++    }
++}
+ use DBI;
+ use Date::Format;
+ 
+@@ -25,30 +43,12 @@
+ }
+ 
+ sub logger {
+-	my $r = shift->last;
++        my $r = _get_req(shift);
+ 
+ 	my $s = $r->server;
+ 	my $c = $r->connection;
+ 
+-	my %data = (
+-		    'server'	=> $s->server_hostname,
+-		    'bytes'     => $r->bytes_sent,
+-		    'filename'	=> $r->filename || '',
+-		    'remotehost'=> $c->remote_host || '',
+-		    'remoteip'  => $c->remote_ip || '',
+-		    'status'    => $r->status || '',
+-		    'urlpath'	=> $r->uri || '',
+-		    'referer'	=> $r->header_in("Referer") || '',	
+-		    'useragent'	=> $r->header_in('User-Agent') || '',
+-		    'timeserved'=> time2str("%Y-%m-%d %X", time),
+-		    'contenttype' => $r->content_type || ''
+-	);
+-
+-	if (my $user = $c->user) {
+-		$data{user} = $user;
+-	}
+-
+-	$data{usertrack} = $r->notes('cookie') || '';
++	my %data = _get_data($r);
+ 
+ 	my $dbh = DBI->connect($r->dir_config("DBILogger_data_source"), $r->dir_config("DBILogger_username"), $r->dir_config("DBILogger_password"));
+   
+@@ -57,16 +57,12 @@
+   		return DECLINED;
+   	}
+   	
+-  	my @valueslist;
+-  	
+-  	foreach (keys %data) {
+-		$data{$_} = $dbh->quote($data{$_});
+-		push @valueslist, $data{$_};
+-	}
+-
+ 	my $table = $r->dir_config("DBILogger_table") || 'requests';
+ 
+-	my $statement = "insert into $table (". join(',', keys %data) .") VALUES (". join(',', @valueslist) .")";
++        my @columns = map($dbh->quote_identifier($_), keys   %data);
++        my @values  = map($dbh->quote($_),            values %data);
++
++	my $statement = "INSERT INTO $table (" . join(', ', @columns) . ") VALUES (" . join(', ', @values ) . ")";
+ 
+ 	my $tries = 0;
+ 	
+@@ -98,10 +94,75 @@
+ # #perl pun: <q[merlyn]> windows is for users who can't handle the power of the mac.
+ 
+ sub handler { 
+-	shift->post_connection(\&logger);
++        _register_logger(shift);
++}
++
++############################################################
++# Multi-API compatibility functions follow
++#
++# _register_logger, _get_req and _get_data should take care of handling the
++# incompatibility between the mod_perl 1.x and 2.x APIs. They should do exactly
++# the same, although in a different way; they are based on
++# http://perl.apache.org/docs/2.0/user/porting/compat.html
++#
++# For any bugs regarding this code, please contact Gunnar Wolf
++# <gwolf at debian.org>.
++sub _register_logger {
++        my $r = shift;
++	if ($modperl2) {
++	        $r->pool->cleanup_register(\&logger, $r);
++	} else {
++		$r->post_connection(\&logger);
++	}
+ 	return OK;
+ }
+ 
++sub _get_req {
++        return $modperl2 ? shift : shift->last;
++}
++
++sub _get_data {
++        my ($r, $s, $c, %data);
++	$r = shift;
++	$s = $r->server;
++	$c = $r->connection;
++
++	if ($modperl2) {
++	        %data = (
++			 'server'	=> $s->server_hostname,
++			 'bytes'        => $r->bytes_sent,
++			 'filename'	=> $r->filename || '',
++			 'remotehost'   => $c->get_remote_host || '',
++			 'remoteip'     => $c->remote_addr->ip_get || '',
++			 'status'       => $r->status || '',
++			 'urlpath'	=> $r->uri || '',
++			 'referer'	=> $r->headers_in->{'Referer'} || '',
++			 'useragent'	=> $r->headers_in->{'User-Agent'} || '',
++			 'timeserved'   => time2str("%Y-%m-%d %X", time),
++			 'contenttype'  => $r->content_type || '',
++			 'user'         => $r->user() || '',
++			 'usertrack'    => $r->notes->get('cookie') || ''
++			 );
++	} else {
++	        %data = (
++			 'server'	=> $s->server_hostname,
++			 'bytes'        => $r->bytes_sent,
++			 'filename'	=> $r->filename || '',
++			 'remotehost'   => $c->remote_host || '',
++			 'remoteip'     => $c->remote_ip || '',
++			 'status'       => $r->status || '',
++			 'urlpath'	=> $r->uri || '',
++			 'referer'	=> $r->header_in("Referer") || '',
++			 'useragent'	=> $r->header_in('User-Agent') || '',
++			 'timeserved'   => time2str("%Y-%m-%d %X", time),
++			 'contenttype'  => $r->content_type || '',
++			 'user'         => $c->user || '',
++			 'usertrack'    => $r->notes('cookie') || ''
++			 );
++	}
++	return %data;
++}
++
+ 1;
+ __END__
+ 
+@@ -139,6 +200,10 @@
+   KEY timeserved_idx (timeserved)
+ );
+ 
++Please note that for some databases (notably, PostgreSQL) you will need to
++double-quote the user column name (that is, to specify it as C<"user"
++varchar(15)>) in order for the database not to mistake it with a keyword.
++
+ Its recommended that you include
+ 
+ use Apache::DBI;
+@@ -267,6 +332,19 @@
+ You might get problems with Apache 1.2.x. (Not supporting
+ post_connection?)
+ 
++=head1 MOD_PERL 2 SUPPORT
++
++The official version of this module, as Ask Bjoern Hansen last modified
++it, lacks support for the API changes introduced with Apache 2.x and
++the corresponding mod_perl 2.x - Of course, this is quite understandable
++as this module was last updated in 1998 ;-) But anyway, the module does its
++job still quite fine, and users still require its functionality.
++
++For any help requests regarding this module on Apache 2 systems, contact
++Gunnar Wolf <gwolf at debian.org> directly. If your system is based on Debian
++GNU/Linux, you can use the regular Debian bugtracking facilities, as the
++multi-API patch was introduced specifically for Debian.
++
+ =head1 SUPPORT
+ 
+ This module is supported via the mod_perl mailinglist

Added: trunk/libapache-dbilogger-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/trunk/libapache-dbilogger-perl/debian/patches/series?rev=15984&op=file
==============================================================================
--- trunk/libapache-dbilogger-perl/debian/patches/series (added)
+++ trunk/libapache-dbilogger-perl/debian/patches/series Fri Feb 29 20:08:41 2008
@@ -1,0 +1,1 @@
+apache2.patch

Modified: trunk/libapache-dbilogger-perl/debian/rules
URL: http://svn.debian.org/wsvn/trunk/libapache-dbilogger-perl/debian/rules?rev=15984&op=diff
==============================================================================
--- trunk/libapache-dbilogger-perl/debian/rules (original)
+++ trunk/libapache-dbilogger-perl/debian/rules Fri Feb 29 20:08:41 2008
@@ -6,6 +6,8 @@
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
+
+include /usr/share/quilt/quilt.make
 
 # If set to a true value then MakeMaker's prompt function will
 # always return the default without waiting for user input.
@@ -20,7 +22,7 @@
 TMP     =$(CURDIR)/debian/$(PACKAGE)
 
 build: build-stamp
-build-stamp:
+build-stamp: $(QUILT_STAMPFN)
 	dh_testdir
 
 	$(PERL) Makefile.PL INSTALLDIRS=vendor
@@ -29,7 +31,7 @@
 
 	touch $@
 
-clean:
+clean: unpatch
 	dh_testdir
 	dh_testroot
 




More information about the Pkg-perl-cvs-commits mailing list