Dual-Life / Time-Piece

Object Oriented time objects
Other
15 stars 33 forks source link

require Time::Piece has problem in Time::Piece 1.31_02 #31

Closed yuki-kimoto closed 7 years ago

yuki-kimoto commented 7 years ago

I have a problem in Time::Piece 1.31_02 and Perl 5.16.3

The following code don't work.

# Don't work use "require"
require Time::Piece;
Time::Piece->strptime("20101112", '%Y%m%d');

use is OK.

# Work well use "use"
use Time::Piece;
Time::Piece->strptime("20101112", '%Y%m%d');  

In Time::Piece 1.31, This problem don't occur.

Do you know this bug reason?

yuki-kimoto commented 7 years ago

I search the reason of this bug. It maybe $Time::Piece::locales is undef when "require Time::Piece".

When "use Time::Piece", $Time::Piece::locales is the following one.

  'AM' => 'AM'
  'PM' => 'PM'
  'alt_month' => ARRAY(0x55365a0)
     0  'January'
     1  'February'
     2  'March'
     3  'April'
     4  'May'
     5  'June'
     6  'July'
     7  'August'
     8  'September'
     9  'October'
     10  'November'
     11  'December'
  'am' => 'am'
  'c_fmt' => ''
  'mon' => ARRAY(0x4fa4a10)
     0  'Jan'
     1  'Feb'
     2  'Mar'
     3  'Apr'
     4  'May'
     5  'Jun'
     6  'Jul'
     7  'Aug'
     8  'Sep'
     9  'Oct'
     10  'Nov'
     11  'Dec'
  'month' => ARRAY(0x55365a0)
     -> REUSED_ADDRESS
  'pm' => 'pm'
  'wday' => ARRAY(0x4fa48f0)
     0  'Sun'
     1  'Mon'
     2  'Tue'
     3  'Wed'
     4  'Thu'
     5  'Fri'
     6  'Sat'
  'weekday' => ARRAY(0x4fa4950)
     0  'Sunday'
     1  'Monday'
     2  'Tuesday'
     3  'Wednesday'
     4  'Thursday'
     5  'Friday'
     6  'Saturday'
smith153 commented 7 years ago

Hi, Yes, 1.31_02 is an in development release. 1.31 is still the stable release. How did you install it? cpan clients should still be choosing 1.31 by default.

yuki-kimoto commented 7 years ago

@smith153

I'm reported that in Perl 5.26(next released Perl) Validator::Custom test fail.

http://dcollins.cc/p5p/fail.Validator-Custom-1.0201.x86_64-linux-thread-multi.3.16.0-4-amd64.1492028609.26581.rpt

And I can't know the reason of it, so I try latest Time::Piece.

cpanm Time::Piece@1.31_02

And I found a bug, and reported it to this issue.

smith153 commented 7 years ago

To back track, you are the maintainer for Validator::Custom and you got a failed smoker test from perl "5.26"? Checking the latest source shows blead still at 1.31: https://github.com/Perl/perl5/tree/blead/cpan/Time-Piece So not sure why that smoker is running with a dev release of a cpan module. I need to update my dev code and push out another stable release. I'll try to do that sometime in the next week.

In your Makefile.PL, could you add a "TEST_REQUIRES" section and include Time::Piece there? Then at least in failed tests, it should show us what version was installed in reports (I think)

Thanks for the report,

smith153 commented 7 years ago

This should be fixed in 1.31_03 Regards,

yuki-kimoto commented 7 years ago

Thank you!