|
From: Erik W. S. <er...@se...> - 2002-09-30 05:38:03
|
Don't know if we have any boxes with 5.x at work, but I'll look. Tend to
be a fair number of slackware boxes with old stuff.
As a related question... does it make sense for us to support 5.005?
It's what, 5 years old and 5.8 is out? Just wondering as it allows for
things that I think are nicer:
use warnings; vs -w
$self->{$which}($self, ...) as function calls which make sense (I never
liked the -> for func calls)
and other nicetieis.
Just curious.
-e
Mike Schilli wrote:
>Hi all,
>
>I can't believe I'm doing this -- but I today I thought: Why not do something totally crazy?
>
>So, I sat down and changed a couple of files in Log::Log4perl to run with 5.005_03. It was easier
>than I thought at first.
>
>Eric pointed out correctly that the modules we're using are indeed supported for perl 5.005_03
>(Log::Dispatch, Test::Simple, etc.). All that I needed to change is replace "our" by "use vars", get
>rid of "use warnings" and change calls like
>
> $self->{$which}($self, ...)
>
>to
>
> $self->{$which}->($self, ...)
>
>(which is probably the right thing to do anyway) and, boom, test suite passes.
>
>Can you two 5.005_03 enthusiasts (Eric and asc) please try out the patch attached to this email?
>Should be as easy as grabbing the latest Log::Log4perl 0.24 and do
>
> cd Log-Log4perl-0.24
> patch -p0 <../patch.500503.txt
>
>Please let me know if it works for you ... and then we'll have to decide if we can work against our
>beliefs and make Log::Log4perl compatible with 5.005_03 :).
>
>-- Mike
>
>############################
># Mike Schilli #
># log...@pe... #
># http://perlmeister.com #
># log4perl.sourceforge.net #
>############################
>
>
>------------------------------------------------------------------------
>
>Index: lib/Log/Log4perl.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl.pm,v
>retrieving revision 1.68
>diff -a -u -r1.68 Log4perl.pm
>--- lib/Log/Log4perl.pm 27 Sep 2002 17:56:09 -0000 1.68
>+++ lib/Log/Log4perl.pm 29 Sep 2002 04:33:49 -0000
>@@ -2,9 +2,8 @@
> package Log::Log4perl;
> ##################################################
>
>-use 5.006;
>+use 5.00503;
> use strict;
>-use warnings;
>
> use Log::Log4perl::Logger;
> use Log::Log4perl::Level;
>@@ -12,11 +11,13 @@
> use Log::Dispatch::Screen;
> use Log::Log4perl::Appender;
>
>-our $VERSION = '0.24';
>+use vars qw($VERSION $caller_depth);
>+
>+$VERSION = '0.24';
>
> # set this to '1' if you're using a wrapper
> # around Log::Log4perl
>-our $caller_depth = 0;
>+$caller_depth = 0;
>
> ##################################################
> sub import {
>Index: lib/Log/Log4perl/Appender.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/Appender.pm,v
>retrieving revision 1.11
>diff -a -u -r1.11 Appender.pm
>--- lib/Log/Log4perl/Appender.pm 20 Sep 2002 07:31:46 -0000 1.11
>+++ lib/Log/Log4perl/Appender.pm 29 Sep 2002 04:33:50 -0000
>@@ -2,14 +2,15 @@
> package Log::Log4perl::Appender;
> ##################################################
>
>-use 5.006;
>+use 5.00503;
> use strict;
>-use warnings;
>
> use Log::Log4perl::Level;
> use constant DEBUG => 0;
>
>-our $unique_counter = 0;
>+use vars qw($unique_counter);
>+
>+$unique_counter = 0;
>
> ##################################################
> sub reset {
>Index: lib/Log/Log4perl/Config.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/Config.pm,v
>retrieving revision 1.24
>diff -a -u -r1.24 Config.pm
>--- lib/Log/Log4perl/Config.pm 22 Sep 2002 18:16:56 -0000 1.24
>+++ lib/Log/Log4perl/Config.pm 29 Sep 2002 04:33:51 -0000
>@@ -2,9 +2,8 @@
> package Log::Log4perl::Config;
> ##################################################
>
>-use 5.006;
>+use 5.00503;
> use strict;
>-use warnings;
>
> use Log::Log4perl::Logger;
> use Log::Log4perl::Level;
>@@ -25,7 +24,9 @@
> FATAL emergency
> );
>
>-our $DEFAULT_WATCH_DELAY = 60; #seconds
>+use vars qw($DEFAULT_WATCH_DELAY);
>+
>+$DEFAULT_WATCH_DELAY = 60; #seconds
>
> ###########################################
> sub init {
>Index: lib/Log/Log4perl/DateFormat.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/DateFormat.pm,v
>retrieving revision 1.5
>diff -a -u -r1.5 DateFormat.pm
>--- lib/Log/Log4perl/DateFormat.pm 8 Sep 2002 20:30:29 -0000 1.5
>+++ lib/Log/Log4perl/DateFormat.pm 29 Sep 2002 04:33:52 -0000
>@@ -1,10 +1,11 @@
> ###########################################
> package Log::Log4perl::DateFormat;
> ###########################################
>-use warnings;
> use strict;
>
>-our $GMTIME = 0;
>+use vars qw($GMTIME);
>+
>+$GMTIME = 0;
>
> my @MONTH_NAMES = qw(
> January February March April May June July
>Index: lib/Log/Log4perl/JavaMap.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/JavaMap.pm,v
>retrieving revision 1.8
>diff -a -u -r1.8 JavaMap.pm
>--- lib/Log/Log4perl/JavaMap.pm 6 Sep 2002 21:40:58 -0000 1.8
>+++ lib/Log/Log4perl/JavaMap.pm 29 Sep 2002 04:33:52 -0000
>@@ -3,7 +3,9 @@
> use Carp;
> use strict;
>
>-our %translate = (
>+use vars qw(%translate);
>+
>+%translate = (
> 'org.apache.log4j.ConsoleAppender' =>
> 'Log::Log4perl::JavaMap::ConsoleAppender',
> 'org.apache.log4j.FileAppender' =>
>Index: lib/Log/Log4perl/Level.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/Level.pm,v
>retrieving revision 1.10
>diff -a -u -r1.10 Level.pm
>--- lib/Log/Log4perl/Level.pm 18 Sep 2002 04:33:28 -0000 1.10
>+++ lib/Log/Log4perl/Level.pm 29 Sep 2002 04:33:52 -0000
>@@ -2,10 +2,10 @@
> package Log::Log4perl::Level;
> ##################################################
>
>-use 5.006;
>+use 5.00503;
> use strict;
>-use warnings;
> use Carp;
>+use vars qw(%PRIORITY %LEVELS %SYSLOG);
>
> # log4j, for whatever reason, puts 0 as all and MAXINT as OFF.
> # this seems less optimal, as more logging would imply a higher
>@@ -21,9 +21,9 @@
> no strict qw(refs);
> use vars qw(%PRIORITY %LEVELS);
>
>-our %PRIORITY = (); # unless (%PRIORITY);
>-our %LEVELS = () unless (%LEVELS);
>-our %SYSLOG = () unless (%SYSLOG);
>+%PRIORITY = (); # unless (%PRIORITY);
>+%LEVELS = () unless (%LEVELS);
>+%SYSLOG = () unless (%SYSLOG);
>
> sub add_priority {
> my ($prio, $intval, $syslog) = @_;
>Index: lib/Log/Log4perl/Logger.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/Logger.pm,v
>retrieving revision 1.32
>diff -a -u -r1.32 Logger.pm
>--- lib/Log/Log4perl/Logger.pm 19 Sep 2002 19:12:22 -0000 1.32
>+++ lib/Log/Log4perl/Logger.pm 29 Sep 2002 04:33:54 -0000
>@@ -2,31 +2,33 @@
> package Log::Log4perl::Logger;
> ##################################################
>
>-use 5.006;
>+use 5.00503;
> use strict;
>-use warnings;
>
> use Log::Log4perl::Level;
> use Log::Log4perl::Layout;
> use Log::Log4perl::Appender;
> use Log::Dispatch;
> use Carp;
>-use Carp::Heavy;
>
> use constant DEBUG => 0;
>+use vars qw($ROOT_LOGGER $LOGGERS_BY_NAME %APPENDER_BY_NAME $INITIALIZED
>+ $DISPATCHER $WATCH_DELAY $FILE_TO_WATCH $LAST_CHECKED_AT
>+ $LAST_CHANGED_AT
>+ );
>
> # Initialization
>-our $ROOT_LOGGER;
>-our $LOGGERS_BY_NAME = {};
>-our %APPENDER_BY_NAME = ();
>-our $INITIALIZED;
>-
>-our $DISPATCHER = Log::Dispatch->new();
>-
>-our $WATCH_DELAY;
>-our $FILE_TO_WATCH;
>-our $LAST_CHECKED_AT;
>-our $LAST_CHANGED_AT;
>+$ROOT_LOGGER;
>+$LOGGERS_BY_NAME = {};
>+%APPENDER_BY_NAME = ();
>+$INITIALIZED;
>+
>+$DISPATCHER = Log::Dispatch->new();
>+
>+$WATCH_DELAY;
>+$FILE_TO_WATCH;
>+$LAST_CHECKED_AT;
>+$LAST_CHANGED_AT;
>
> __PACKAGE__->reset();
>
>@@ -488,7 +490,7 @@
>
> my $which = Log::Log4perl::Level::to_level($priority);
>
>- $self->{$which}($self, @messages,
>+ $self->{$which}->($self, @messages,
> Log::Log4perl::Level::to_level($priority));
> }
>
>@@ -578,7 +580,7 @@
> *{__PACKAGE__ . "::$lclevel"} = sub {
> print "$lclevel: ($_[0]->{category}/$_[0]->{level}) [@_]\n" if DEBUG;
> init_warn() unless $INITIALIZED;
>- $_[0]->{$level}(@_, $level);
>+ $_[0]->{$level}->(@_, $level);
> };
>
> *{__PACKAGE__ . "::is_$lclevel"} = sub {
>Index: lib/Log/Log4perl/TestBuffer.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/TestBuffer.pm,v
>retrieving revision 1.5
>diff -a -u -r1.5 TestBuffer.pm
>--- lib/Log/Log4perl/TestBuffer.pm 23 Sep 2002 16:45:43 -0000 1.5
>+++ lib/Log/Log4perl/TestBuffer.pm 29 Sep 2002 04:33:54 -0000
>@@ -10,7 +10,9 @@
> use base qw( Log::Dispatch::Output );
> use fields qw( stderr );
>
>-our %POPULATION = ();
>+use vars qw(%POPULATION);
>+
>+%POPULATION = ();
>
> ##################################################
> sub new {
>Index: lib/Log/Log4perl/Layout/PatternLayout.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/Layout/PatternLayout.pm,v
>retrieving revision 1.15
>diff -a -u -r1.15 PatternLayout.pm
>--- lib/Log/Log4perl/Layout/PatternLayout.pm 25 Sep 2002 03:11:06 -0000 1.15
>+++ lib/Log/Log4perl/Layout/PatternLayout.pm 29 Sep 2002 04:33:55 -0000
>@@ -2,16 +2,17 @@
> package Log::Log4perl::Layout::PatternLayout;
> ##################################################
>
>-use 5.006;
>+use 5.00503;
> use strict;
>-use warnings;
> use Log::Log4perl::Level;
> use Log::Log4perl::DateFormat;
> use File::Spec;
>+use vars qw($TIME_HIRES_AVAILABLE $TIME_HIRES_AVAILABLE_WARNED
>+ $PROGRAM_START_TIME);
>
>-our $TIME_HIRES_AVAILABLE;
>-our $TIME_HIRES_AVAILABLE_WARNED = 0;
>-our $PROGRAM_START_TIME;
>+$TIME_HIRES_AVAILABLE;
>+$TIME_HIRES_AVAILABLE_WARNED = 0;
>+$PROGRAM_START_TIME;
>
> BEGIN {
> # Check if we've got Time::HiRes. If not, don't make a big fuss,
>Index: lib/Log/Log4perl/Layout/SimpleLayout.pm
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/lib/Log/Log4perl/Layout/SimpleLayout.pm,v
>retrieving revision 1.4
>diff -a -u -r1.4 SimpleLayout.pm
>--- lib/Log/Log4perl/Layout/SimpleLayout.pm 19 Jul 2002 19:05:31 -0000 1.4
>+++ lib/Log/Log4perl/Layout/SimpleLayout.pm 29 Sep 2002 04:33:56 -0000
>@@ -5,9 +5,8 @@
> # http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/SimpleLayout.html
> ##################################################
>
>-use 5.006;
>+use 5.00503;
> use strict;
>-use warnings;
> use Log::Log4perl::Level;
>
> no strict qw(refs);
>Index: t/002Logger.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/002Logger.t,v
>retrieving revision 1.15
>diff -a -u -r1.15 002Logger.t
>--- t/002Logger.t 10 Sep 2002 07:57:34 -0000 1.15
>+++ t/002Logger.t 29 Sep 2002 04:33:56 -0000
>@@ -5,7 +5,6 @@
>
> #use Data::Dump qw(dump);
>
>-use warnings;
> use strict;
>
> #########################
>Index: t/003Layout.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/003Layout.t,v
>retrieving revision 1.19
>diff -a -u -r1.19 003Layout.t
>--- t/003Layout.t 25 Sep 2002 05:06:23 -0000 1.19
>+++ t/003Layout.t 29 Sep 2002 04:33:57 -0000
>@@ -3,7 +3,6 @@
> # Mike Schilli, 2002 (m...@pe...)
> ###########################################
>
>-use warnings;
> use strict;
>
> #########################
>@@ -33,7 +32,7 @@
>
> ok($app->buffer(), "bugo % def.ghi " .
> File::Spec->catfile(qw(t 003Layout.t)) .
>- " 32 hugo");
>+ " 31 hugo");
>
> ############################################################
> # Log the message
>@@ -111,7 +110,7 @@
> $logger->debug("That's the message");
>
> ok($app->buffer(), File::Spec->catfile(qw(t 003Layout.t)) .
>- "-111 That's the message");
>+ "-110 That's the message");
>
> ############################################################
> # Don't append a newline if the message already contains one
>Index: t/010JConsole.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/010JConsole.t,v
>retrieving revision 1.5
>diff -a -u -r1.5 010JConsole.t
>--- t/010JConsole.t 24 Sep 2002 14:52:48 -0000 1.5
>+++ t/010JConsole.t 29 Sep 2002 04:33:57 -0000
>@@ -4,9 +4,9 @@
> use Test;
>
> my $WORK_DIR = 't/tmp';
>-our @outfiles = ("$WORK_DIR/test1.log",);
>+my @outfiles = ("$WORK_DIR/test1.log",);
> unless (-e "$WORK_DIR"){
>- mkdir "$WORK_DIR" || die "can't create $WORK_DIR $!";
>+ mkdir("$WORK_DIR", 0755) || die "can't create $WORK_DIR $!";
> }
> foreach my $f (@outfiles){
> unlink $f if (-e $f);
>Index: t/011JFile.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/011JFile.t,v
>retrieving revision 1.3
>diff -a -u -r1.3 011JFile.t
>--- t/011JFile.t 9 Jul 2002 07:45:39 -0000 1.3
>+++ t/011JFile.t 29 Sep 2002 04:33:57 -0000
>@@ -2,9 +2,9 @@
> use Test;
>
> my $WORK_DIR = 't/tmp';
>-our @outfiles = ("$WORK_DIR/test2.log",);
>+my @outfiles = ("$WORK_DIR/test2.log",);
> unless (-e "$WORK_DIR"){
>- mkdir "$WORK_DIR" || die "can't create $WORK_DIR $!";
>+ mkdir("$WORK_DIR", 0755) || die "can't create $WORK_DIR $!";
> }
> foreach my $f (@outfiles){
> unlink $f if (-e $f);
>Index: t/012Deeper.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/012Deeper.t,v
>retrieving revision 1.3
>diff -a -u -r1.3 012Deeper.t
>--- t/012Deeper.t 10 Jul 2002 19:58:22 -0000 1.3
>+++ t/012Deeper.t 29 Sep 2002 04:33:57 -0000
>@@ -9,7 +9,7 @@
>
> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> my $today = sprintf("%4.4d%2.2d%2.2d",$year+1900, $mon+1, $mday);
>-our @outfiles = ("t/tmp/deeper1.log",
>+my @outfiles = ("t/tmp/deeper1.log",
> "t/tmp/deeper6.log",
> "t/tmp/deeper7.log",
> );
>Index: t/016Export.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/016Export.t,v
>retrieving revision 1.6
>diff -a -u -r1.6 016Export.t
>--- t/016Export.t 10 Sep 2002 07:57:34 -0000 1.6
>+++ t/016Export.t 29 Sep 2002 04:33:57 -0000
>@@ -5,7 +5,6 @@
> # Mike Schilli, 2002 (m...@pe...)
> ###########################################
>
>-use warnings;
> use strict;
>
> #########################
>Index: t/017Watch.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/017Watch.t,v
>retrieving revision 1.3
>diff -a -u -r1.3 017Watch.t
>--- t/017Watch.t 20 Sep 2002 18:45:14 -0000 1.3
>+++ t/017Watch.t 29 Sep 2002 04:33:57 -0000
>@@ -2,7 +2,6 @@
>
> use Test;
>
>-use warnings;
> use strict;
>
> use Log::Log4perl;
>Index: t/018Init.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/018Init.t,v
>retrieving revision 1.1
>diff -a -u -r1.1 018Init.t
>--- t/018Init.t 3 Aug 2002 19:22:30 -0000 1.1
>+++ t/018Init.t 29 Sep 2002 04:33:58 -0000
>@@ -2,7 +2,6 @@
>
> use Test;
>
>-use warnings;
> use strict;
>
> use Log::Log4perl;
>Index: t/019Warn.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/019Warn.t,v
>retrieving revision 1.2
>diff -a -u -r1.2 019Warn.t
>--- t/019Warn.t 4 Aug 2002 20:01:40 -0000 1.2
>+++ t/019Warn.t 29 Sep 2002 04:33:58 -0000
>@@ -1,6 +1,5 @@
> # Check if warnings are issued for weirdo configurations
>
>-use warnings;
> use strict;
>
> use Test;
>Index: t/020Easy.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/020Easy.t,v
>retrieving revision 1.2
>diff -a -u -r1.2 020Easy.t
>--- t/020Easy.t 25 Sep 2002 04:54:01 -0000 1.2
>+++ t/020Easy.t 29 Sep 2002 04:33:58 -0000
>@@ -1,6 +1,5 @@
> # Tests for the lazy man's logger with easy_init()
>
>-use warnings;
> use strict;
>
> use Test;
>Index: t/021AppThres.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/021AppThres.t,v
>retrieving revision 1.3
>diff -a -u -r1.3 021AppThres.t
>--- t/021AppThres.t 22 Sep 2002 18:37:17 -0000 1.3
>+++ t/021AppThres.t 29 Sep 2002 04:33:58 -0000
>@@ -3,7 +3,6 @@
> # Mike Schilli, 2002 (m...@pe...)
> ###########################################
>
>-use warnings;
> use strict;
>
> use Test;
>Index: t/022Wrap.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/022Wrap.t,v
>retrieving revision 1.3
>diff -a -u -r1.3 022Wrap.t
>--- t/022Wrap.t 11 Aug 2002 00:08:06 -0000 1.3
>+++ t/022Wrap.t 29 Sep 2002 04:33:58 -0000
>@@ -2,7 +2,6 @@
> # Tests for Log4perl used by a wrapper class
> # Mike Schilli, 2002 (m...@pe...)
> ###########################################
>-use warnings;
> use strict;
>
> use Test;
>@@ -14,8 +13,9 @@
>
> use Log::Log4perl;
> use Log::Log4perl::Level;
>+use vars qw(@ISA);
>
>-our @ISA = qw(Log::Log4perl);
>+@ISA = qw(Log::Log4perl);
>
> sub get_logger {
> # This is highly stupid (object duplication) and definitely not what we
>Index: t/023Date.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/023Date.t,v
>retrieving revision 1.7
>diff -a -u -r1.7 023Date.t
>--- t/023Date.t 22 Sep 2002 18:37:17 -0000 1.7
>+++ t/023Date.t 29 Sep 2002 04:33:58 -0000
>@@ -3,7 +3,6 @@
> # Mike Schilli, 2002 (m...@pe...)
> ###########################################
>
>-use warnings;
> use strict;
>
> use Test;
>Index: t/024WarnDieCarp.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/024WarnDieCarp.t,v
>retrieving revision 1.2
>diff -a -u -r1.2 024WarnDieCarp.t
>--- t/024WarnDieCarp.t 10 Sep 2002 07:57:34 -0000 1.2
>+++ t/024WarnDieCarp.t 29 Sep 2002 04:33:59 -0000
>@@ -14,7 +14,6 @@
> #
> ######################################################################
>
>-use warnings;
> use strict;
>
> use Test::Simple tests => 49;
>Index: t/026FileApp.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/026FileApp.t,v
>retrieving revision 1.1
>diff -a -u -r1.1 026FileApp.t
>--- t/026FileApp.t 14 Sep 2002 18:45:19 -0000 1.1
>+++ t/026FileApp.t 29 Sep 2002 04:33:59 -0000
>@@ -2,7 +2,6 @@
>
> use Test;
>
>-use warnings;
> use strict;
>
> use Log::Log4perl;
>Index: t/027Watch2.t
>===================================================================
>RCS file: /cvsroot/log4perl/Log-Log4perl/t/027Watch2.t,v
>retrieving revision 1.3
>diff -a -u -r1.3 027Watch2.t
>--- t/027Watch2.t 23 Sep 2002 16:49:29 -0000 1.3
>+++ t/027Watch2.t 29 Sep 2002 04:33:59 -0000
>@@ -4,7 +4,6 @@
>
> use Test;
>
>-use warnings;
> use strict;
>
> use Log::Log4perl;
>
>
|