Bug 94926

Summary: [PATCH] devel/p5-Time-Piece: Silence 'redefined' warnings
Product: Ports & Packages Reporter: Lars Thegler <lth>
Component: Individual Port(s)Assignee: Anton Berezin <tobez>
Status: Closed FIXED    
Severity: Affects Only Me CC: tobez
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
p5-Time-Piece-1.09_1.patch none

Description Lars Thegler freebsd_committer freebsd_triage 2006-03-25 14:20:12 UTC
Time::Piece boldly redefines gmtime and localtime. If these are
already redefined, Time::Piece throws fugly warnings:

--cut--
Subroutine Class::DBI::mysql::localtime redefined at /usr/local/lib/perl5/site_perl/5.8.8/mach/Time/Piece.pm line 124.
Subroutine Class::DBI::mysql::gmtime redefined at /usr/local/lib/perl5/site_perl/5.8.8/mach/Time/Piece.pm line 124.
--cut--

This patch has also been sent upstream:

 http://rt.cpan.org//Ticket/Display.html?id=18358

Added file(s):
- files/patch-Piece.pm

Port maintainer (tobez@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.63
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2006-03-25 14:24:28 UTC
Responsible Changed
From-To: freebsd-ports-bugs->tobez

Over to maintainer
Comment 2 Anton Berezin freebsd_committer freebsd_triage 2006-03-25 14:26:03 UTC
On Sat, Mar 25, 2006 at 03:16:09PM +0100, Lars Thegler wrote:

> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ files/patch-Piece.pm	25 Mar 2006 14:11:30 -0000
> @@ -0,0 +1,10 @@
> +--- ./Piece.pm.orig	Sun Feb 26 20:49:20 2006
> ++++ ./Piece.pm	Sun Feb 26 20:49:50 2006
> +@@ -121,6 +121,7 @@
> +   for my $method (@methods) {
> +     if (exists $_special_exports{$method}) {
> +       no strict 'refs';
> ++      no warnings 'redefine';
> +       *{$to . "::$method"} = $_special_exports{$method}->($class);
> +     } else {
> +       $class->SUPER::export($to, $method);

While we do not go to extreme lengths to support base system perl on
4.X, it is still unfortunate that this patch will break the port there
(which otherwise works fine with 5.005_03).

Maybe this version would be preferable?

--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-Piece.pm	25 Mar 2006 14:11:30 -0000
@@ -0,0 +1,10 @@
+--- ./Piece.pm.orig	Sun Feb 26 20:49:20 2006
++++ ./Piece.pm	Sun Feb 26 20:49:50 2006
+@@ -121,6 +121,7 @@
+   for my $method (@methods) {
+     if (exists $_special_exports{$method}) {
+       no strict 'refs';
++      local $^W;
+       *{$to . "::$method"} = $_special_exports{$method}->($class);
+     } else {
+       $class->SUPER::export($to, $method);

\Anton.
-- 
An undefined problem has an infinite number of solutions.
-- Robert A. Humphrey
Comment 3 Lars Thegler freebsd_committer freebsd_triage 2006-03-25 15:34:01 UTC
Anton Berezin wrote:
> Maybe this version would be preferable?
> ++      local $^W;

Indeed.

/Lars
Comment 4 Anton Berezin freebsd_committer freebsd_triage 2006-03-28 12:03:10 UTC
State Changed
From-To: open->closed

The fix has been committed. Thank you for your submission.