Hello community, here is the log from the commit of package perl-Tk-Clock for openSUSE:Factory checked in at 2015-04-02 16:04:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Tk-Clock (Old) and /work/SRC/openSUSE:Factory/.perl-Tk-Clock.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Tk-Clock" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Tk-Clock/perl-Tk-Clock.changes 2013-08-23 11:07:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Tk-Clock.new/perl-Tk-Clock.changes 2015-04-02 16:04:28.000000000 +0200 @@ -1,0 +2,34 @@ +Fri Mar 27 14:35:07 UTC 2015 - [email protected] + +- update to version 0.39 from 0.36 + Upstream changes: + + 0.39 + * Remove perl recommendation from META as it breaks cpan clients + + 0.38 + * Fix skip_all. require Test::More 0.88 + + 0.37 + * Use 12:15 AM instead of 00:15 AM + * Upped Copyright to 2015 + +------------------------------------------------------------------- +Fri Sep 19 12:15:51 UTC 2014 - [email protected] + +- updated to 0.36 + * Fix locales for non-utf8 (and windows) + * Upped Copyright to 2014 + * Make sure boolean attributes are 0 or 1 + * Protect internal attributes from new and config calls + * Dynamically determine width of digital date and time + +------------------------------------------------------------------- +Fri Oct 4 09:13:36 UTC 2013 - [email protected] + +- updated to 0.35 + * Indented SYNOPSIS (RT#85697 - Djibril Ousmanou) + * Support for locales in long day and month formats + * Support for local offset (in seconds) + +------------------------------------------------------------------- Old: ---- Tk-Clock-0.34.tgz New: ---- Tk-Clock-0.39.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Tk-Clock.spec ++++++ --- /var/tmp/diff_new_pack.A7mSdm/_old 2015-04-02 16:04:28.000000000 +0200 +++ /var/tmp/diff_new_pack.A7mSdm/_new 2015-04-02 16:04:28.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Tk-Clock # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,38 +16,32 @@ # -%bcond_with test - Name: perl-Tk-Clock -Version: 0.34 +Version: 0.39 Release: 0 %define cpan_name Tk-Clock Summary: Clock widget with analog and digital display -License: GPL-1.0+ or Artistic-1.0 +License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Tk-Clock/ -Source: http://www.cpan.org/authors/id/H/HM/HMBRAND/Tk-Clock-%{version}.tgz +Source: http://www.cpan.org/authors/id/H/HM/HMBRAND/%{cpan_name}-%{version}.tgz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros -BuildRequires: perl(ExtUtils::MakeMaker) -%if %{with test} -BuildRequires: perl(Test::Harness) -BuildRequires: perl(Test::More) BuildRequires: perl(Test::NoWarnings) -%endif -# -BuildRequires: perl(Carp) BuildRequires: perl(Tk) >= 402.000 BuildRequires: perl(Tk::Canvas) BuildRequires: perl(Tk::Derived) BuildRequires: perl(Tk::Widget) -Requires: perl(Carp) +Requires: perl(Test::NoWarnings) Requires: perl(Tk) >= 402.000 Requires: perl(Tk::Canvas) Requires: perl(Tk::Derived) Requires: perl(Tk::Widget) +Recommends: perl(Encode) >= 2.59 +Recommends: perl(Test::More) >= 1.001003 +Recommends: perl(Tk) >= 804.032 %{perl_requires} %description @@ -59,30 +53,19 @@ %prep %setup -q -n %{cpan_name}-%{version} find . -type f -print0 | xargs -0 chmod 644 -##rpmlint -# wrong-script-interpreter -%{__perl} -p -i -e 's|/pro/bin/perl|%{__perl}|' examples/*.pl %build %{__perl} Makefile.PL INSTALLDIRS=vendor %{__make} %{?_smp_mflags} -## skipping test -# ....couldn't connect to display ":0" -%if %{with test} - %check %{__make} test -%endif %install %perl_make_install %perl_process_packlist %perl_gen_filelist -%clean -%{__rm} -rf %{buildroot} - %files -f %{name}.files %defattr(-,root,root,755) %doc ChangeLog examples README ++++++ Tk-Clock-0.34.tgz -> Tk-Clock-0.39.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/ChangeLog new/Tk-Clock-0.39/ChangeLog --- old/Tk-Clock-0.34/ChangeLog 2013-05-28 13:35:07.000000000 +0200 +++ new/Tk-Clock-0.39/ChangeLog 2015-02-12 09:23:28.000000000 +0100 @@ -1,3 +1,26 @@ +0.39 - 12 Feb 2015, H.Merijn Brand + * Move repo to github + * Remove perl recommendation from META as it breaks cpan clients + +0.38 - 03 Jan 2015, H.Merijn Brand + * Fix skip_all. require Test::More 0.88 + +0.37 - 02 Jan 2015, H.Merijn Brand + * Use 12:15 AM instead of 00:15 AM + * Upped Copyright to 2015 + +0.36 - 10 Apr 2014, H.Merijn Brand + * Fix locales for non-utf8 (and windows) + * Upped Copyright to 2014 + * Make sure boolean attributes are 0 or 1 + * Protect internal attributes from new and config calls + * Dynamically determine width of digital date and time + +0.35 - 20 Aug 2013, H.Merijn Brand + * Indented SYNOPSIS (RT#85697 - Djibril Ousmanou) + * Support for locales in long day and month formats + * Support for local offset (in seconds) + 0.34 - 28 May 2013, H.Merijn Brand * Force update if time wound back (ntp, date command) * Upped Copyright to 2013 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/Clock.pm new/Tk-Clock-0.39/Clock.pm --- old/Tk-Clock-0.34/Clock.pm 2013-05-28 13:31:44.000000000 +0200 +++ new/Tk-Clock-0.39/Clock.pm 2015-01-03 11:53:59.000000000 +0100 @@ -5,7 +5,7 @@ use strict; use warnings; -our $VERSION = "0.34"; +our $VERSION = "0.39"; use Carp; @@ -23,6 +23,7 @@ my %def_config = ( timeZone => "", + useLocale => "C", backDrop => "", useAnalog => 1, @@ -41,6 +42,7 @@ ana24hour => 0, countDown => 0, timerValue => 0, + localOffset => 0, useInfo => 0, @@ -72,33 +74,101 @@ _anaSize => $ana_base, # Default size (height & width) _digSize => 26, # Height + _digWdth => 72, # Width ); +my %locale = ( + C => { + month => [ + # m mm mmm mmmm + [ "1", "01", "Jan", "January" ], + [ "2", "02", "Feb", "February" ], + [ "3", "03", "Mar", "March" ], + [ "4", "04", "Apr", "April" ], + [ "5", "05", "May", "May" ], + [ "6", "06", "Jun", "June" ], + [ "7", "07", "Jul", "July" ], + [ "8", "08", "Aug", "August" ], + [ "9", "09", "Sep", "September"], + [ "10", "10", "Oct", "October" ], + [ "11", "11", "Nov", "November" ], + [ "12", "12", "Dec", "December" ], + ], + day => [ + # ddd dddd + [ "Sun", "Sunday" ], + [ "Mon", "Monday" ], + [ "Tue", "Tuesday" ], + [ "Wed", "Wednesday" ], + [ "Thu", "Thursday" ], + [ "Fri", "Friday" ], + [ "Sat", "Saturday" ], + ], + }, + ); + +sub _booleans +{ + my $data = shift; + $data->{$_} = !!$data->{$_} for qw( + ana24hour + autoScale + countDown + handCenter + useAnalog + useDigital + useInfo + useSecHand + ); + } # _booleans + +sub _decode +{ + my $s = shift; + $s && $s =~ m{[\x80-\xff]} or return $s; + my $u = eval { Encode::decode ("UTF-8", $s, Encode::FB_CROAK) }; + return ($@ ? $s : $u); + } # _decode + +sub _newLocale +{ + my $locale = shift or return $locale{C}; + + require POSIX; + require Encode; + + my $curloc = POSIX::setlocale (&POSIX::LC_TIME, "") || "C"; + my $newloc = POSIX::setlocale (&POSIX::LC_TIME, $locale) || "C"; + $locale{$newloc} and return $locale{$newloc}; + + my $l = $locale{$locale} = {}; + foreach my $m (0 .. 11) { + @{$l->{month}[$m]} = map { _decode ($_) } + $m + 1, $locale{C}{month}[$m][1], + POSIX::strftime ("%b", 0, 0, 0, 1, $m, 113), + POSIX::strftime ("%B", 0, 0, 0, 1, $m, 113); + } + foreach my $d (0 .. 6) { + @{$l->{day}[$d]} = map { _decode ($_) } + POSIX::strftime ("%a", 0, 0, 0, $d - 1, 0, 113), + POSIX::strftime ("%A", 0, 0, 0, $d - 1, 0, 113); + } + + POSIX::setlocale (&POSIX::LC_TIME, $curloc); + + return $l; + } # _newLocale + sub _month # (month, size) -{ # m mm mmm mmmm - [[ "1", "01", "Jan", "January" ], - [ "2", "02", "Feb", "February" ], - [ "3", "03", "Mar", "March" ], - [ "4", "04", "Apr", "April" ], - [ "5", "05", "May", "May" ], - [ "6", "06", "Jun", "June" ], - [ "7", "07", "Jul", "July" ], - [ "8", "08", "Aug", "August" ], - [ "9", "09", "Sep", "September" ], - [ "10", "10", "Oct", "October" ], - [ "11", "11", "Nov", "November" ], - [ "12", "12", "Dec", "December" ]]->[$_[0]][$_[1]]; +{ + my ($locale, $m, $l) = @_; + ($locale{$locale} || $locale{C})->{month}[$m][$l]; } # _month sub _wday # (wday, size) { - [[ "Sun", "Sunday" ], - [ "Mon", "Monday" ], - [ "Tue", "Tuesday" ], - [ "Wed", "Wednesday" ], - [ "Thu", "Thursday" ], - [ "Fri", "Friday" ], - [ "Sat", "Saturday" ]]->[$_[0]][$_[1]]; + my ($locale, $m, $l) = @_; + ($locale{$locale} || $locale{C})->{day}[$m][$l]; } # _wday sub _min @@ -149,7 +219,7 @@ my $hght = $data->{useAnalog} * $data->{_anaSize} + $data->{useDigital} * $data->{_digSize} + 1; my $wdth = _max ($data->{useAnalog} * $data->{_anaSize}, - $data->{useDigital} * 72); + $data->{useDigital} * $data->{_digWdth}); my $dim = "${wdth}x${hght}"; my $geo = $clock->parent->geometry; my ($pw, $ph) = split m/\D/, $geo; # Cannot use ->cget here @@ -200,8 +270,29 @@ my $clock = shift; my $data = $clock->privateData; + + # Dynamically determine the size of the digital display + my @t = localtime (time + $data->{localOffset}); + my ($wd, $hd) = do { + my $s_date = $data->{fmtd}->(@t, 0, 0, 0); + $s_date =~ s/\b([0-9])\b/0$1/g; # prepare "d" running from 9 to 10 + my $f = $clock->Label (-font => $data->{dateFont})->cget (-font); + my %fm = $clock->fontMetrics ($f); + ($clock->fontMeasure ($f, $s_date), $fm{"-linespace"} || 9); + }; + my ($wt, $ht) = do { + my $s_time = $data->{fmtt}->(@t, 0, 0, 0); + $s_time =~ s/\b([0-9])\b/0$1/g; # prepare "h" running from 9 to 10 + my $f = $clock->Label (-font => $data->{timeFont})->cget (-font); + my %fm = $clock->fontMetrics ($f); + ($clock->fontMeasure ($f, $s_time), $fm{"-linespace"} || 9); + }; + my $w = _max (72, int (1.1 * _max ($wt, $wd))); + $data->{_digSize} = $hd + 4 + $ht + 4; # height of date + time + $data->{_digWdth} = $w; + my $wdth = _max ($data->{useAnalog} * $data->{_anaSize}, - $data->{useDigital} * 72); + $data->{useDigital} * $w); my ($pad, $anchor) = (5, "s"); my ($x, $y) = ($wdth / 2, $data->{useAnalog} * $data->{_anaSize}); if ($data->{digiAlign} eq "left") { @@ -210,14 +301,14 @@ elsif ($data->{digiAlign} eq "right") { ($anchor, $x) = ("se", $wdth - $pad); } - $clock->createText ($x, $y + $data->{_digSize}, + $clock->createText ($x, $y + $ht + 4 + $hd, -anchor => $anchor, -width => ($wdth - 2 * $pad), -font => $data->{dateFont}, -fill => $data->{dateColor}, -text => $data->{dateFormat}, -tags => "date"); - $clock->createText ($x, $y + 13, + $clock->createText ($x, $y + $ht + 2, -anchor => $anchor, -width => ($wdth - 2 * $pad), -font => $data->{timeFont}, @@ -363,9 +454,11 @@ if (ref $args eq "HASH") { foreach my $arg (keys %$args) { (my $attr = $arg) =~ s/^-//; + $attr =~ m/^_/ and next; # Internal use only! exists $data->{$attr} and $data->{$attr} = delete $args->{$arg}; } } + _booleans ($data); $clock->SUPER::Populate ($args); @@ -392,6 +485,7 @@ useInfo => 99991, tickFreq => 99992, anaScale => 99995, + useLocale => 1, ); sub config @@ -414,14 +508,17 @@ } my $data = $clock->privateData; + $attr_weight{$_} ||= unpack "s>", $_ for keys %def_config; + my $autoScale; # sort, so the recreational attribute will be done last foreach my $conf_spec ( map { $_->[0] } sort { $a->[1] <=> $b->[1] } - map { [ $_, $attr_weight{$_} || unpack "s>", $_ ] } + map { [ $_, $attr_weight{$_} ] } keys %$conf) { (my $attr = $conf_spec) =~ s/^-//; + $attr =~ m/^_/ and next; # Internal use only! defined $def_config{$attr} && defined $data->{$attr} or next; my $old = $data->{$attr}; $data->{$attr} = $conf->{$conf_spec}; @@ -447,6 +544,15 @@ elsif ($attr eq "timeFont") { $clock->itemconfigure ("time", -font => $data->{timeFont}); } + elsif ($attr eq "infoColor") { + $clock->itemconfigure ("info", -fill => $data->{infoColor}); + } + elsif ($attr eq "infoFont") { + $clock->itemconfigure ("info", -font => $data->{infoFont}); + } + elsif ($attr eq "useLocale") { + $locale{$data->{useLocale}} or _newLocale ($data->{useLocale}); + } elsif ($attr eq "dateFormat" || $attr eq "timeFormat" || $attr eq "infoFormat") { my %fmt = ( "S" => '%d', # 45 @@ -482,16 +588,17 @@ my @fmt = split m/\b($xfmt)\b/, $fmt; my $args = ""; $fmt = ""; + my $locale = $data->{useLocale} || "C"; foreach my $f (@fmt) { if (defined $fmt{$f}) { $fmt .= $fmt{$f}; if ($f =~ m/^m+$/) { my $l = length ($f) - 1; - $args .= ", Tk::Clock::_month (\$m, $l)"; + $args .= ", Tk::Clock::_month (q{$locale}, \$m, $l)"; } elsif ($f =~ m/^ddd+$/) { my $l = length ($f) - 3; - $args .= ", Tk::Clock::_wday (\$wd, $l)"; + $args .= ", Tk::Clock::_wday (q{$locale}, \$wd, $l)"; } else { $args .= ', $' . substr ($f, 0, 1); @@ -513,6 +620,8 @@ q[ my $w = $yd / 7 + 1; ], q[ my $h = $H % 12; ], q[ my $A = $H > 11 ? "PM" : "AM"; ], + # AM/PM users expect 12:15 AM instead of 00:15 AM + q[ $h ||= 12; ], qq[ sprintf qq!$fmt!$args; ], q[ } ]; } @@ -606,6 +715,7 @@ } } } + _booleans ($data); if (defined $autoScale) { $data->{autoScale} = $autoScale; if ($autoScale) { @@ -629,7 +739,7 @@ my $data = $clock->privateData; $data->{timeZone} and local $ENV{TZ} = $data->{timeZone}; - my $t = time; + my $t = time + $data->{localOffset}; $t == $data->{_time_} and return; # Same time, no update $t < $data->{_time_} and # Time wound back (ntp or date command) ($data->{Clock_h}, $data->{Clock_m}, $data->{Clock_s}) = (-1, -1, -1); @@ -658,8 +768,11 @@ unless ($t[2] == $data->{Clock_h}) { $data->{Clock_h} = $t[2]; + $data->{fmtd} ||= sub { + sprintf "%02d-%02d-%02d", $_[3], $_[4] + 1, $_[5] + 1900; + }; $data->{useDigital} and - $clock->itemconfigure ("date", -text => &{$data->{fmtd}} (@t)); + $clock->itemconfigure ("date", -text => $data->{fmtd}->(@t)); } unless ($t[1] == $data->{Clock_m}) { @@ -679,11 +792,13 @@ $data->{useSecHand} and $clock->coords ("sec", $clock->_where ($data->{Clock_s}, 34, $data->{_anaSize})); + $data->{fmti} ||= sub { sprintf "%02d:%02d:%02d", @_[2,1,0]; }; $data->{useInfo} and - $clock->itemconfigure ("info", -text => &{$data->{fmti}} (@t)); + $clock->itemconfigure ("info", -text => $data->{fmti}->(@t)); } + $data->{fmtt} ||= sub { sprintf "%02d:%02d:%02d", @_[2,1,0]; }; $data->{useDigital} and - $clock->itemconfigure ("time", -text => &{$data->{fmtt}} (@t)); + $clock->itemconfigure ("time", -text => $data->{fmtt}->(@t)); $data->{autoScale} and $clock->_resize_auto; } # _run @@ -698,43 +813,45 @@ =head1 SYNOPSIS -use Tk -use Tk::Clock; - -$clock = $parent->Clock (?-option => <value> ...?); - -$clock->config ( # These reflect the defaults - timeZone => "", - backDrop => "", - - useAnalog => 1, - handColor => "Green4", - secsColor => "Green2", - tickColor => "Yellow4", - tickFreq => 1, - tickDiff => 0, - useSecHand => 1, - handCenter => 0, - anaScale => 100, - autoScale => 0, - ana24hour => 0, - countDown => 0, - timerValue => 0, + use Tk + use Tk::Clock; - useInfo => 0, - infoColor => "#cfb53b", - infoFormat => "HH:MM:SS", - infoFont => "fixed 6", + $clock = $parent->Clock (?-option => <value> ...?); - useDigital => 1, - digiAlign => "center", - timeFont => "fixed 6", - timeColor => "Red4", - timeFormat => "HH:MM:SS", - dateFont => "fixed 6", - dateColor => "Blue4", - dateFormat => "dd-mm-yy", - ); + $clock->config ( # These reflect the defaults + timeZone => "", + useLocale => "C", + backDrop => "", + + useAnalog => 1, + handColor => "Green4", + secsColor => "Green2", + tickColor => "Yellow4", + tickFreq => 1, + tickDiff => 0, + useSecHand => 1, + handCenter => 0, + anaScale => 100, + autoScale => 0, + ana24hour => 0, + countDown => 0, + timerValue => 0, + localOffset => 0, + + useInfo => 0, + infoColor => "#cfb53b", + infoFormat => "HH:MM:SS", + infoFont => "fixed 6", + + useDigital => 1, + digiAlign => "center", + timeFont => "fixed 6", + timeColor => "Red4", + timeFormat => "HH:MM:SS", + dateFont => "fixed 6", + dateColor => "Blue4", + dateFormat => "dd-mm-yy", + ); =head1 DESCRIPTION @@ -832,6 +949,14 @@ the this value. When the time reaches 0, all countdown values are reset to 0. +=item localOffset (0) + +The value of this attribute represents the local offset for this clock +in seconds. Negative is back in time, positive is in the future. + + # Wind back clock 4 days, 5 hours, 6 minutes and 7 seconds + $clock->config (localOffset => -363967); + =item handColor ("Green4") =item secsColor ("Green2") @@ -886,6 +1011,18 @@ $clock->config (timeZone => "Europe/Amsterdam"); $clock->config (timeZone => "MET-1METDST"); +=item useLocale ("C") + +Use this locale for the text shown in month formats C<mmm> and C<mmmm> and in +day formats C<ddd> and C<dddd>. + + $clock->config (useLocale => $ENV{LC_TIME} // $ENV{LC_ALL} + // $ENV{LANG} // "nl_NL.utf8"); + +See L<http://docs.moodle.org/dev/Table_of_locales> for a table of locales +and the Windows equivalents. Windows might not have a UTF8 version available +of the required locale. + =item timeFont ("fixed 6") Controls the font to be used for the top line in the digital clock. Will @@ -916,6 +1053,9 @@ $clock->config (timeFormat => "hh:MM A"); +The text shown in the formats C<ddd>, C<dddd>, C<mmm>, and C<mmmm> might be +influenced by the setting of C<useLocale>. The fallback is locale "C". + =item dateFont ("fixed 6") Controls the font to be used for the bottom line in the digital clock. Will @@ -1012,8 +1152,6 @@ =head1 TODO -* Using POSIX' strftime () for dateFormat. Current implementation - would probably make this very slow. * Full support for multi-line date- and time-formats with auto-resize. * Countdown clock API, incl action when done. * Better docs for the attributes @@ -1036,7 +1174,7 @@ =head1 COPYRIGHT AND LICENSE -Copyright (C) 1999-2013 H.Merijn Brand +Copyright (C) 1999-2015 H.Merijn Brand This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/MANIFEST new/Tk-Clock-0.39/MANIFEST --- old/Tk-Clock-0.34/MANIFEST 2013-05-29 09:19:11.000000000 +0200 +++ new/Tk-Clock-0.39/MANIFEST 2015-02-12 09:28:07.000000000 +0100 @@ -6,6 +6,7 @@ examples/24hour.pl examples/cdclock.pl examples/countdown.pl +examples/random.pl examples/simple.pl examples/station.pl examples/world.pl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/META.json new/Tk-Clock-0.39/META.json --- old/Tk-Clock-0.34/META.json 2013-05-29 09:19:11.000000000 +0200 +++ new/Tk-Clock-0.39/META.json 2015-02-12 09:28:07.000000000 +0100 @@ -1,66 +1,66 @@ { + "resources" : { + "repository" : { + "type" : "git", + "web" : "https://github.com/Tux/Tk-Clock", + "url" : "https://github.com/Tux/Tk-Clock" + }, + "license" : [ + "http://dev.perl.org/licenses/" + ] + }, + "dynamic_config" : 1, "prereqs" : { "runtime" : { "recommends" : { - "perl" : "5.016003", - "Tk" : "804.031" - }, + "Tk" : "804.032", + "Encode" : "2.70" + }, "requires" : { "Tk::Canvas" : "0", "Tk::Derived" : "0", - "Tk::Widget" : "0", + "perl" : "5.006", "Tk" : "402.000", + "Encode" : "0", "Carp" : "0", - "perl" : "5.006" - } - }, - "test" : { - "requires" : { - "Test::Harness" : "0", - "Test::More" : "0", - "Test::NoWarnings" : "0" - }, - "recommends" : { - "Test::More" : "0.98", - "Test::Harness" : "3.28" - } - }, + "POSIX" : "0", + "Tk::Widget" : "0" + } + }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" - } } }, - "generated_by" : "Author", - "resources" : { - "repository" : { - "type" : "git", - "web" : "http://repo.or.cz/w/Tk-Clock.git", - "url" : "http://repo.or.cz/r/Tk-Clock.git" + "test" : { + "recommends" : { + "Test::More" : "1.001014" }, - "license" : [ - "http://dev.perl.org/licenses/" - ] - }, + "requires" : { + "Test::NoWarnings" : "0", + "Test::More" : "0.88" + } + } + }, "author" : [ "H.Merijn Brand <[email protected]>" - ], - "provides" : { - "Tk::Clock" : { - "file" : "Clock.pm", - "version" : "0.34" - } - }, - "abstract" : "Clock widget with analog and digital display", - "name" : "Tk-Clock", + ], + "version" : "0.39", "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" - }, - "version" : "0.34", + }, + "provides" : { + "Tk::Clock" : { + "version" : "0.39", + "file" : "Clock.pm" + } + }, "license" : [ "perl_5" - ], + ], "release_status" : "stable", - "dynamic_config" : 1 - } + "generated_by" : "Author", + "abstract" : "Clock widget with analog and digital display", + "name" : "Tk-Clock" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/META.yml new/Tk-Clock-0.39/META.yml --- old/Tk-Clock-0.34/META.yml 2013-05-29 09:19:11.000000000 +0200 +++ new/Tk-Clock-0.39/META.yml 2015-02-12 09:28:07.000000000 +0100 @@ -5,7 +5,7 @@ configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 -generated_by: Author, CPAN::Meta::Converter version 2.130880 +generated_by: Author, CPAN::Meta::Converter version 2.143240 license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -14,16 +14,16 @@ provides: Tk::Clock: file: Clock.pm - version: '0.34' + version: '0.39' recommends: - Test::Harness: '3.28' - Test::More: '0.98' - Tk: '804.031' - perl: '5.016003' + Encode: '2.70' + Test::More: '1.001014' + Tk: '804.032' requires: Carp: 0 - Test::Harness: 0 - Test::More: 0 + Encode: 0 + POSIX: 0 + Test::More: '0.88' Test::NoWarnings: 0 Tk: '402.000' Tk::Canvas: 0 @@ -32,5 +32,5 @@ perl: '5.006' resources: license: http://dev.perl.org/licenses/ - repository: http://repo.or.cz/r/Tk-Clock.git -version: '0.34' + repository: https://github.com/Tux/Tk-Clock +version: '0.39' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/Makefile.PL new/Tk-Clock-0.39/Makefile.PL --- old/Tk-Clock-0.34/Makefile.PL 2013-02-13 09:30:55.000000000 +0100 +++ new/Tk-Clock-0.39/Makefile.PL 2015-02-12 09:23:28.000000000 +0100 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Copyright PROCURA B.V. (c) 1999-2013 H.Merijn Brand +# Copyright PROCURA B.V. (c) 1999-2015 H.Merijn Brand require 5.006; @@ -25,8 +25,10 @@ "Tk::Derived" => 0, "Tk::Widget" => 0, "Carp" => 0, - "Test::More" => 0, + "Test::More" => 0.88, "Test::NoWarnings" => 0, + "Encode" => 0, + "POSIX" => 0, }, dist => { COMPRESS => "gzip -9f", @@ -58,6 +60,13 @@ "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES) 3>valgrind.log ); + + my $min_vsn = ($] >= 5.010 && -d "xt" && -d "sandbox" && ($ENV{AUTOMATED_TESTING} || 0) != 1) + ? join "\n" => + 'test ::', + ' -@env TEST_FILES="xt/*.t" make -e test_dynamic', + '' + : ""; join "\n" => 'cover test_cover:', ' ccache -C', @@ -84,7 +93,8 @@ ' -@mv -f $(DISTVNAME).tar.gz $(DISTVNAME).tgz', ' -@cpants_lint.pl $(DISTVNAME).tgz', ' -@rm -f Debian_CPANTS.txt', - ''; + '', + $min_vsn; } # postamble 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/README new/Tk-Clock-0.39/README --- old/Tk-Clock-0.34/README 2013-01-01 22:22:43.000000000 +0100 +++ new/Tk-Clock-0.39/README 2015-02-12 09:01:17.000000000 +0100 @@ -12,21 +12,21 @@ ration, which makes it not Y2K compliant. COPYING: - Copyright (c) 1998-2013 H.Merijn Brand. All rights reserved. + Copyright (c) 1998-2015 H.Merijn Brand. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Recent changes can be (re)viewed in the public GIT repository - at http://repo.or.cz/w/Tk-Clock.git + at https://github.com/Tux/Tk-Clock Feel free to clone your own copy: - $ git clone http://repo.or.cz/r/Tk-Clock.git Tk-Clock + $ git clone https://github.com/Tux/Tk-Clock Tk-Clock or get it as a tgz: $ wget --output-document=Tk-Clock-git.tgz \ - 'http://repo.or.cz/w/Tk-Clock.git?a=snapshot;sf=tgz' + https://github.com/Tux/Tk-Clock/archive/master.tar.gz PREREQUISITES perl5 (probably 5.004.04 or better) @@ -64,7 +64,7 @@ See ChangeLog COPYRIGHT AND LICENSE - Copyright (C) 1999-2013 H.Merijn Brand + Copyright (C) 1999-2015 H.Merijn Brand This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/examples/random.pl new/Tk-Clock-0.39/examples/random.pl --- old/Tk-Clock-0.34/examples/random.pl 1970-01-01 01:00:00.000000000 +0100 +++ new/Tk-Clock-0.39/examples/random.pl 2013-08-20 12:50:12.000000000 +0200 @@ -0,0 +1,46 @@ +#!/pro/bin/perl + +use Tk; +use Tk::Clock; + +my @bw = qw( Black White ); + +use Getopt::Long qw(:config bundling nopermute); +GetOptions ( + "r|rev|wb|white-on-black" => sub { @bw = reverse @bw }, + ) or die "usage: station.pl [--white-on-black]\n"; + +my $m = MainWindow->new; + +$m->configure ( + -foreground => $bw[0], + -background => $bw[1], + ); + +my $c = $m->Clock ( + -background => $bw[1], + -relief => "flat", + )->pack ( + -anchor => "c", + -expand => 1, + -fill => "both", + -padx => "10", + -pady => "10", + ); +$c->config ( + useDigital => 0, + useAnalog => 1, + secsColor => "Red", + handColor => $bw[0], + tickColor => $bw[0], + tickFreq => 1, + tickDiff => 1, + handCenter => 1, + anaScale => 500, + autoScale => 1, + ); + +srand (time); +$m->repeat (2500, sub { $c->config (localOffset => int rand 86400); }); + +MainLoop; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/t/10_base.t new/Tk-Clock-0.39/t/10_base.t --- old/Tk-Clock-0.34/t/10_base.t 2012-04-17 08:27:52.000000000 +0200 +++ new/Tk-Clock-0.39/t/10_base.t 2015-01-03 11:43:20.000000000 +0100 @@ -3,8 +3,8 @@ use strict; use warnings; -use Test::More tests => 23; -use Test::NoWarnings; +use Test::More; +require Test::NoWarnings; BEGIN { use_ok ("Tk"); @@ -12,10 +12,25 @@ } my ($delay, $period, $m, $c) = (0, $ENV{TK_TEST_LENGTH} || 5000); -$m = eval { MainWindow->new (-title => "clock"); } or - skip_all ("No valid Tk environment"); +unless ($m = eval { MainWindow->new (-title => "clock") }) { + diag ("No valid Tk environment"); + done_testing; + exit 0; + } ok ($c = $m->Clock (-background => "Black"), "Clock Widget"); + +# Safe to use en_US.UTF-8, as the fallback is C and all values are the same +foreach my $loc ("C", "en_US.UTF-8") { + is (Tk::Clock::_month ($loc, 0, 0), "1", "Month format m Jan in $loc"); + is (Tk::Clock::_month ($loc, 2, 1), "03", "Month format mm Mar in $loc"); + is (Tk::Clock::_month ($loc, 4, 2), "May", "Month format mmm May in $loc"); + is (Tk::Clock::_month ($loc, 6, 3), "July", "Month format mmmm Jul in $loc"); + + is (Tk::Clock::_wday ($loc, 0, 0), "Sun", "Weekday format ddd Sun in $loc"); + is (Tk::Clock::_wday ($loc, 2, 1), "Tuesday", "Weekday format dddd Tue in $loc"); + } + like ($c->config ( tickColor => "Orange", handColor => "Red", @@ -59,9 +74,10 @@ ok ($c->config ( useAnalog => 1, useInfo => 1, - useDigital => 1, + useDigital => 4, # Should be normalized to 1 dateFormat => "m/d/y", timeFormat => "hh:MM A", + _digSize => 800, # Should be ignored ), "Maroon4 AD m/d/y hh:MM A"); }); @@ -106,6 +122,9 @@ useAnalog => 0, useInfo => 0, useDigital => 1, + useLocale => ($^O eq "MSWin32" ? "Japanese_Japan.932" : "ja_JP.utf8"), + timeFont => "Helvetica 8", + dateFont => "Helvetica 8", dateFormat => "dddd\nd mmm yyy", timeFormat => "", ), "Purple4 aD dddd\\nd mmm yyy ''"); @@ -119,6 +138,8 @@ useInfo => 1, useDigital => 0, anaScale => 300, + timeFont => "Helvetica 12", + dateFont => "Helvetica 12", infoFormat => "Tk-Clock", ), "Gray75 Ad scale 300"); }); @@ -159,6 +180,7 @@ $c->after ($delay, sub { $c->configure (-background => "Black"); ok ($c->config ({ + anaScale => 250, useAnalog => 1, useInfo => 0, useDigital => 0, @@ -168,17 +190,31 @@ handCenter => 1, tickFreq => 1, tickDiff => 1, - anaScale => 250, }), " Station clock: hand centers and tick width"); }); $delay += $period; $c->after ($delay, sub { + $c->configure (-background => "Black"); + ok ($c->config ({ + useInfo => 1, + useDigital => 1, + anaScale => 300, + dateFormat => "dd-mm-yyyy", + timeFormat => "HH:MM:SS", + localOffset => -363967, # minus 4 days, 5 hours, 6 minutes and 7 seconds + }), " Station clock: Time offset -4'05:06:07"); + }); + +$delay += $period; +$c->after ($delay, sub { $c->destroy; ok (!Exists ($c), "Destroy Clock"); $m->destroy; ok (!Exists ($m), "Destroy Main"); - exit; + + Test::NoWarnings::had_no_warnings (); + done_testing; }); MainLoop; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/t/20_resize.t new/Tk-Clock-0.39/t/20_resize.t --- old/Tk-Clock-0.34/t/20_resize.t 2012-04-17 08:29:17.000000000 +0200 +++ new/Tk-Clock-0.39/t/20_resize.t 2015-01-03 11:34:24.000000000 +0100 @@ -3,8 +3,8 @@ use strict; use warnings; -use Test::More tests => 8; -use Test::NoWarnings; +use Test::More; +require Test::NoWarnings; BEGIN { use_ok ("Tk"); @@ -12,8 +12,11 @@ } my ($delay, $m, $c) = ($ENV{TK_TEST_LENGTH} || 10000); -$m = eval { MainWindow->new (-title => "clock"); } or - skip_all ("No valid Tk environment"); +unless ($m = eval { MainWindow->new (-title => "clock") }) { + diag ("No valid Tk environment"); + done_testing; + exit 0; + } ok ($c = $m->Clock (-background => "Black"), "Clock Widget"); like ($c->config ( @@ -34,7 +37,9 @@ ok (!Exists ($c), "Destroy Clock"); $m->destroy; ok (!Exists ($m), "Destroy Main"); - exit; + + Test::NoWarnings::had_no_warnings (); + done_testing; }); MainLoop; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/t/30_dual.t new/Tk-Clock-0.39/t/30_dual.t --- old/Tk-Clock-0.34/t/30_dual.t 2012-04-17 08:30:14.000000000 +0200 +++ new/Tk-Clock-0.39/t/30_dual.t 2015-01-03 11:34:34.000000000 +0100 @@ -3,8 +3,8 @@ use strict; use warnings; -use Test::More tests => 20; -use Test::NoWarnings; +use Test::More; +require Test::NoWarnings; BEGIN { use_ok ("Tk"); @@ -12,8 +12,11 @@ } my ($delay, $period, $m, $c) = (0, $ENV{TK_TEST_LENGTH} || 5000); -$m = eval { MainWindow->new (-title => "clock", -background => "Black"); } or - skip_all ("No valid Tk environment"); +unless ($m = eval { MainWindow->new (-title => "clock", -background => "Black") }) { + diag ("No valid Tk environment"); + done_testing; + exit 0; + } my %defconfig = ( -background => "Black", @@ -70,7 +73,8 @@ like ($c4->config ( anaScale => 200, countDown => 1, - infoFormat => "Tissot", + useLocale => ($^O eq "MSWin32" ? "Japanese_Japan.932" : "ja_JP.utf8"), + infoFormat => "ddd mmm", handColor => "Yellow", timeZone => "Asia/Tokyo", dateFormat => "Asia/Tokyo", @@ -88,7 +92,9 @@ ok (!Exists ($_), "Destroy Clock") for $c1, $c2, $c3, $c4; $m->destroy; ok (!Exists ($m), "Destroy Main"); - exit; + + Test::NoWarnings::had_no_warnings (); + done_testing; }); MainLoop; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tk-Clock-0.34/t/40_backdrop.t new/Tk-Clock-0.39/t/40_backdrop.t --- old/Tk-Clock-0.34/t/40_backdrop.t 2012-04-17 08:33:04.000000000 +0200 +++ new/Tk-Clock-0.39/t/40_backdrop.t 2015-01-03 11:48:33.000000000 +0100 @@ -3,45 +3,53 @@ use strict; use warnings; -use Test::More tests => 10; -use Test::NoWarnings; +use Test::More; +require Test::NoWarnings; BEGIN { use_ok ("Tk"); - use_ok ("Tk::PNG"); use_ok ("Tk::Photo"); use_ok ("Tk::Clock"); } -SKIP: { - $Tk::PNG::VERSION or skip "Cannot load Tk::PNG", 7; - - my $delay = $ENV{TK_TEST_LENGTH} || 5000; - my $m = eval { MainWindow->new (-title => "clock"); } or - skip_all ("No valid Tk environment"); - - ok (my $c = $m->Clock (-relief => "flat"), "base clock"); - ok (my $p1 = $m->Photo (-file => "t/eye.png"), "Photo 1"); - ok (my $p2 = $m->Photo (-file => "t/eye2.png"), "Photo 2"); - ok ($c->config ( - backDrop => $p1, - timeFont => "{Liberation Mono} 11", - dateFont => "{Liberation Mono} 11", - timeFormat => " ", - dateFormat => "ddd, dd mmm yyyy", - dateColor => "Navy", - handColor => "#ffe0e0", - useSecHand => 0, - tickColor => "Blue", - tickDiff => 1, - handCenter => 1, - anaScale => 330, - ), "config ()"); - ok ($c->pack, "pack"); +eval { require "Tk::PNG" }; +unless ($Tk::PNG::VERSION) { + diag "SKIP: cannot load Tk::PNG"; + done_testing; + exit 0; + } - $c->after ( $delay, sub { $c->config (backDrop => $p2) }); +my ($delay, $m) = $ENV{TK_TEST_LENGTH} || 5000; +unless ($m = eval { MainWindow->new (-title => "clock") }) { + diag ("No valid Tk environment"); + done_testing; + exit 0; + } - $c->after (2 * $delay, sub { $_->destroy for $c, $m; exit; }); +ok (my $c = $m->Clock (-relief => "flat"), "base clock"); +ok (my $p1 = $m->Photo (-file => "t/eye.png"), "Photo 1"); +ok (my $p2 = $m->Photo (-file => "t/eye2.png"), "Photo 2"); +ok ($c->config ( + backDrop => $p1, + timeFont => "{Liberation Mono} 11", + dateFont => "{Liberation Mono} 11", + timeFormat => " ", + dateFormat => "ddd, dd mmm yyyy", + dateColor => "Navy", + handColor => "#ffe0e0", + useSecHand => 0, + tickColor => "Blue", + tickDiff => 1, + handCenter => 1, + anaScale => 330, + ), "config ()"); +ok ($c->pack, "pack"); + +$c->after ( $delay, sub { $c->config (backDrop => $p2) }); + +$c->after (2 * $delay, sub { $_->destroy for $c, $m; + Test::NoWarnings::had_no_warnings (); + done_testing; + }); - MainLoop; - } +MainLoop;
