cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Cvs-cvs] ccvs/contrib ChangeLog log_accum.pl


From: Mark D. Baushke
Subject: Re: [Cvs-cvs] ccvs/contrib ChangeLog log_accum.pl
Date: Thu, 03 Aug 2006 18:53:59 -0700

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


>       * log_accum.pl: Use proper Perl constants.

Of possible interest, the use of 'proper Perl constants' was only
introduced in perl 5.8.x. So, this construct

use constant { STATE_NONE => 0 };

requires perl 5.8.x to work without error.

The way to do it in a way compatible to older PERL versions as well as
using the latest and greatest versions of PERL, you might do something
like this:

eval 'use constant {
        STATE_NONE    => 0,
        STATE_CHANGED => 1,
        STATE_ADDED   => 2,
        STATE_REMOVED => 3,
        STATE_LOG     => 4
    };'
|| eval {
    sub STATE_NONE    () { 0; }
    sub STATE_CHANGED () { 1; }
    sub STATE_ADDED   () { 2; }
    sub STATE_REMOVED () { 3; }
    sub STATE_LOG     () { 4; }
};

This would work for for any perl 5.x release (perl 4.x would have
problems with use strict and lots of other stuff).

Failing that, the NEWS file should be updated to provide that the
minimum required perl is 5.8.x now.

        -- Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (FreeBSD)

iD8DBQFE0qi3Cg7APGsDnFERAiVtAKDfZVUPmqoA9VZ47qJCxWqHSQUevACfaz4c
jej93rYbsJR0vszJbNAaQB0=
=eihe
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]