Hello community, here is the log from the commit of package perl-Tie-Cycle for openSUSE:Factory checked in at 2013-11-07 12:53:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Tie-Cycle (Old) and /work/SRC/openSUSE:Factory/.perl-Tie-Cycle.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Tie-Cycle" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Tie-Cycle/perl-Tie-Cycle.changes 2013-07-01 15:59:33.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Tie-Cycle.new/perl-Tie-Cycle.changes 2013-11-07 12:53:40.000000000 +0100 @@ -1,0 +2,8 @@ +Fri Oct 4 09:15:18 UTC 2013 - [email protected] + +- updated to 1.19 + * Update for modern usage, better code + * I use this as an example in Mastering Perl, so I shouldn't + leave embarrassing practices in the code. :) + +------------------------------------------------------------------- Old: ---- Tie-Cycle-1.17.tar.gz New: ---- Tie-Cycle-1.19.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Tie-Cycle.spec ++++++ --- /var/tmp/diff_new_pack.rGUQ4P/_old 2013-11-07 12:53:42.000000000 +0100 +++ /var/tmp/diff_new_pack.rGUQ4P/_new 2013-11-07 12:53:42.000000000 +0100 @@ -17,7 +17,7 @@ Name: perl-Tie-Cycle -Version: 1.17 +Version: 1.19 Release: 0 %define cpan_name Tie-Cycle Summary: Cycle through a list of values via a scalar. @@ -29,7 +29,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros +BuildRequires: perl(Test::More) >= 0.95 #BuildRequires: perl(Tie::Cycle) +Requires: perl(Test::More) >= 0.95 %{perl_requires} %description @@ -47,7 +49,7 @@ During the tie, this module makes a shallow copy of the array reference. If the array reference contains references, and those references are changed after the tie, the elements of the cycle will change as well. See the -included test.pl script for an example of this effect. +included _test.pl_ script for an example of this effect. %prep %setup -q -n %{cpan_name}-%{version} @@ -66,6 +68,6 @@ %files -f %{name}.files %defattr(-,root,root,755) -%doc Changes examples LICENSE README +%doc Changes examples LICENSE MYMETA.json MYMETA.yml README %changelog ++++++ Tie-Cycle-1.17.tar.gz -> Tie-Cycle-1.19.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/Changes new/Tie-Cycle-1.19/Changes --- old/Tie-Cycle-1.17/Changes 2009-01-30 10:48:24.000000000 +0100 +++ new/Tie-Cycle-1.19/Changes 2013-08-27 19:21:17.000000000 +0200 @@ -1,5 +1,10 @@ Revision history for Perl extension Tie::Cycle. +1.19 - Tue Aug 27 13:20:40 2013 + * Update for modern usage, better code + * I use this as an example in Mastering Perl, so I shouldn't + leave embarrassing practices in the code. :) + 1.17 - Fri Jan 30 01:48:06 2009 * Updated the docs for the move to Github * There aren't any code changes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/MANIFEST new/Tie-Cycle-1.19/MANIFEST --- old/Tie-Cycle-1.17/MANIFEST 2009-01-30 10:48:25.000000000 +0100 +++ new/Tie-Cycle-1.19/MANIFEST 2013-08-27 19:21:19.000000000 +0200 @@ -1,9 +1,11 @@ Changes -lib/Cycle.pm examples/README +lib/Tie/Cycle.pm LICENSE Makefile.PL MANIFEST +MYMETA.json +MYMETA.yml README t/cycle.t t/load.t @@ -11,4 +13,5 @@ t/pod.t t/pod_coverage.t t/test_manifest -META.yml Module meta-data (added by MakeMaker) +META.yml Module YAML meta-data (added by MakeMaker) +META.json Module JSON meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/META.json new/Tie-Cycle-1.19/META.json --- old/Tie-Cycle-1.17/META.json 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Cycle-1.19/META.json 2013-08-27 19:21:19.000000000 +0200 @@ -0,0 +1,30 @@ +{ + "abstract" : "Cycle through a list of values via a scalar", + "author" : [ + "brian d foy <[email protected]>" + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Tie-Cycle", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "release_status" : "stable", + "resources" : { + "repository" : { + "type" : "git", + "web" : "https://github.com/briandfoy/tie-cycle" + } + }, + "version" : "1.19" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/META.yml new/Tie-Cycle-1.19/META.yml --- old/Tie-Cycle-1.17/META.yml 2009-01-30 10:48:25.000000000 +0100 +++ new/Tie-Cycle-1.19/META.yml 2013-08-27 19:21:19.000000000 +0200 @@ -1,22 +1,19 @@ ---- #YAML:1.0 -name: Tie-Cycle -version: 1.17 -abstract: Cycle through a list of values via a scalar +--- +abstract: 'Cycle through a list of values via a scalar' author: - - brian d foy <[email protected]> -license: perl -distribution_type: module -configure_requires: - ExtUtils::MakeMaker: 0 -requires: - Test::More: 0 -resources: - Repository: http://github.com/briandfoy/tie-cycle/tree/master -no_index: - directory: - - t - - inc -generated_by: ExtUtils::MakeMaker version 6.48 + - 'brian d foy <[email protected]>' +build_requires: {} +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150' +license: perl meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Tie-Cycle +no_index: + directory: + - t + - inc +resources: + repository: https://github.com/briandfoy/tie-cycle +version: 1.19 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/MYMETA.json new/Tie-Cycle-1.19/MYMETA.json --- old/Tie-Cycle-1.17/MYMETA.json 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Cycle-1.19/MYMETA.json 2013-08-27 19:21:18.000000000 +0200 @@ -0,0 +1,30 @@ +{ + "abstract" : "Cycle through a list of values via a scalar", + "author" : [ + "brian d foy <[email protected]>" + ], + "dynamic_config" : 0, + "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Tie-Cycle", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "release_status" : "stable", + "resources" : { + "repository" : { + "type" : "git", + "web" : "https://github.com/briandfoy/tie-cycle" + } + }, + "version" : "1.19" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/MYMETA.yml new/Tie-Cycle-1.19/MYMETA.yml --- old/Tie-Cycle-1.17/MYMETA.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Cycle-1.19/MYMETA.yml 2013-08-27 19:21:18.000000000 +0200 @@ -0,0 +1,19 @@ +--- +abstract: 'Cycle through a list of values via a scalar' +author: + - 'brian d foy <[email protected]>' +build_requires: {} +dynamic_config: 0 +generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112150' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: Tie-Cycle +no_index: + directory: + - t + - inc +resources: + repository: https://github.com/briandfoy/tie-cycle +version: 1.19 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/Makefile.PL new/Tie-Cycle-1.19/Makefile.PL --- old/Tie-Cycle-1.17/Makefile.PL 2009-01-30 10:48:24.000000000 +0100 +++ new/Tie-Cycle-1.19/Makefile.PL 2013-08-27 19:21:17.000000000 +0200 @@ -1,5 +1,4 @@ -# $Id$ -use ExtUtils::MakeMaker; +use ExtUtils::MakeMaker 6.46; require 5.008; @@ -8,31 +7,26 @@ WriteMakefile( 'NAME' => 'Tie::Cycle', 'ABSTRACT' => 'Cycle through a list of values via a scalar', - 'VERSION_FROM' => 'lib/Cycle.pm', + 'VERSION_FROM' => 'lib/Tie/Cycle.pm', 'LICENSE' => 'perl', 'AUTHOR' => 'brian d foy <[email protected]>', - 'PM' => { - 'lib/Cycle.pm'=> '$(INST_LIBDIR)/Cycle.pm', - }, - 'PREREQ_PM' => { - 'Test::More' => '0', - }, - - 'MAN3PODS' => { - 'lib/Cycle.pm' => '$(INST_MAN3DIR)/Tie::Cycle.3', + 'Test::More' => '0.95', + 'Carp' => '0', }, 'clean' => { FILES => 'Tie-Cycle-*' }, - (eval { ExtUtils::MakeMaker->VERSION(6.46) } - ? (META_MERGE => { - resources => { - Repository => 'http://github.com/briandfoy/tie-cycle/tree/master' - } - }) - : () - ), + 'META_MERGE' => { + 'meta-spec' => { version => 2 }, + resources => { + repository => { + type => 'git', + url => '[email protected]:briandfoy/tie-cycle.git', + web => 'https://github.com/briandfoy/tie-cycle', + }, + }, + }, -); + ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/lib/Cycle.pm new/Tie-Cycle-1.19/lib/Cycle.pm --- old/Tie-Cycle-1.17/lib/Cycle.pm 2009-01-30 10:48:24.000000000 +0100 +++ new/Tie-Cycle-1.19/lib/Cycle.pm 1970-01-01 01:00:00.000000000 +0100 @@ -1,149 +0,0 @@ -# $Id$ -package Tie::Cycle; -use strict; - -use vars qw( $VERSION ); - -$VERSION = '1.17'; - -sub TIESCALAR - { - my $class = shift; - my $list_ref = shift; - - my @shallow_copy = map { $_ } @$list_ref; - - return unless ref $list_ref eq ref []; - - my $self = [ 0, scalar @shallow_copy, \@shallow_copy ]; - - bless $self, $class; - } - -sub FETCH - { - my $self = shift; - - my $index = $$self[0]++; - $$self[0] %= $self->[1]; - - return $self->[2]->[ $index ]; - } - -sub STORE - { - my $self = shift; - my $list_ref = shift; - - return unless ref $list_ref eq ref []; - - $self = [ 0, scalar @$list_ref, $list_ref ]; - } - -sub reset - { - my $self = shift; - - $$self[0] = 0; - } - -sub previous - { - my $self = shift; - - my $index = $$self[0] - 1; - $$self[0] %= $self->[1]; - - return $self->[2]->[ $index ]; - } - -sub next - { - my $self = shift; - - my $index = $$self[0] + 1; - $$self[0] %= $self->[1]; - - return $self->[2]->[ $index ]; - } - -"Tie::Cycle"; - -__END__ - -=head1 NAME - -Tie::Cycle - Cycle through a list of values via a scalar. - -=head1 SYNOPSIS - - use Tie::Cycle; - - tie my $cycle, 'Tie::Cycle', [ qw( FFFFFF 000000 FFFF00 ) ]; - - print $cycle; # FFFFFF - print $cycle; # 000000 - print $cycle; # FFFF00 - print $cycle; # FFFFFF back to the beginning - - (tied $cycle)->reset; # back to the beginning - -=head1 DESCRIPTION - -You use C<Tie::Cycle> to go through a list over and over again. -Once you get to the end of the list, you go back to the beginning. -You don't have to worry about any of this since the magic of -tie does that for you. - -The tie takes an array reference as its third argument. The tie -should succeed unless the argument is not an array reference. -Previous versions required you to use an array that had more -than one element (what's the pointing of looping otherwise?), -but I've removed that restriction since the number of elements -you want to use may change depending on the situation. - -During the tie, this module makes a shallow copy of the array -reference. If the array reference contains references, and those -references are changed after the tie, the elements of the cycle -will change as well. See the included test.pl script for an -example of this effect. - -=head1 OBJECT METHODS - -You can call methods on the underlying object (which you access -with tied() ). - -=over 4 - -=item reset - -Roll the iterator back to the starting position. The next access -will give the first element in the list. - -=item previous - -Give the previous element. This does not affect the current position. - -=item next - -Give the next element. This does not affect the current position. -You can peek at the next element if you like. - -=back - -=head1 SOURCE AVAILABILITY - -This module is on Github: - - http://github.com/briandfoy/tie-cycle/tree/master - -=head1 AUTHOR - -brian d foy, C<< <[email protected]> >> - -=head1 COPYRIGHT AND LICENSE - -Copyright 2000-2009, brian d foy, All rights reserved - -This software is available under the same terms as perl. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/lib/Tie/Cycle.pm new/Tie-Cycle-1.19/lib/Tie/Cycle.pm --- old/Tie-Cycle-1.17/lib/Tie/Cycle.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Cycle-1.19/lib/Tie/Cycle.pm 2013-08-27 19:21:17.000000000 +0200 @@ -0,0 +1,147 @@ +package Tie::Cycle; +use strict; + +our $VERSION = '1.19'; + +use Carp qw(carp); + +use constant CURSOR_COL => 0; +use constant COUNT_COL => 1; +use constant ITEM_COL => 2; + +sub TIESCALAR { + my( $class, $list_ref ) = @_; + my $self = bless [], $class; + + unless( $self->STORE( $list_ref ) ) { + carp "The argument to Tie::Cycle must be an array reference"; + return; + } + + return $self; + } + +sub FETCH { + my( $self ) = @_; + + my $index = $self->[CURSOR_COL]++; + $self->[CURSOR_COL] %= $self->_count; + + return $self->_item( $index ); + } + +sub STORE { + my( $self, $list_ref ) = @_; + return unless ref $list_ref eq ref []; + my @shallow_copy = map { $_ } @$list_ref; + + $self->[CURSOR_COL] = 0; + $self->[COUNT_COL] = scalar @shallow_copy; + $self->[ITEM_COL] = \@shallow_copy; + } + +sub reset { $_[0]->[CURSOR_COL] = 0 } + +sub previous { + my( $self ) = @_; + + my $index = $self->_cursor - 1; + $self->[CURSOR_COL] %= $self->_count; + + return $self->_item( $index ); + } + +sub next { + my( $self ) = @_; + + my $index = $self->_cursor + 1; + $self->[CURSOR_COL] %= $self->_count; + + return $self->_item( $index ); + } + +sub _cursor { $_[0]->[CURSOR_COL] } +sub _count { $_[0]->[COUNT_COL] } +sub _item { $_[0]->[ITEM_COL][ $_[1] // $_[0]->_cursor ] } + +"Tie::Cycle"; + +__END__ + +=head1 NAME + +Tie::Cycle - Cycle through a list of values via a scalar. + +=head1 SYNOPSIS + + use v5.10.1; + use Tie::Cycle; + + tie my $cycle, 'Tie::Cycle', [ qw( FFFFFF 000000 FFFF00 ) ]; + + say $cycle; # FFFFFF + say $cycle; # 000000 + say $cycle; # FFFF00 + say $cycle; # FFFFFF back to the beginning + + (tied $cycle)->reset; # back to the beginning + +=head1 DESCRIPTION + +You use C<Tie::Cycle> to go through a list over and over again. +Once you get to the end of the list, you go back to the beginning. +You don't have to worry about any of this since the magic of +tie does that for you. + +The tie takes an array reference as its third argument. The tie +should succeed unless the argument is not an array reference. +Previous versions required you to use an array that had more +than one element (what's the pointing of looping otherwise?), +but I've removed that restriction since the number of elements +you want to use may change depending on the situation. + +During the tie, this module makes a shallow copy of the array +reference. If the array reference contains references, and those +references are changed after the tie, the elements of the cycle +will change as well. See the included F<test.pl> script for an +example of this effect. + +=head1 OBJECT METHODS + +You can call methods on the underlying object (which you access +with C<tied()> ). + +=over 4 + +=item reset + +Roll the iterator back to the starting position. The next access +will give the first element in the list. + +=item previous + +Give the previous element. This does not affect the current position. + +=item next + +Give the next element. This does not affect the current position. +You can peek at the next element if you like. + +=back + +=head1 SOURCE AVAILABILITY + +This module is on Github: + + https://github.com/briandfoy/tie-cycle + +=head1 AUTHOR + +brian d foy, C<< <[email protected]> >> + +=head1 COPYRIGHT AND LICENSE + +Copyright 2000-2013, brian d foy, All rights reserved + +This software is available under the same terms as perl. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/t/cycle.t new/Tie-Cycle-1.19/t/cycle.t --- old/Tie-Cycle-1.17/t/cycle.t 2009-01-30 10:48:24.000000000 +0100 +++ new/Tie-Cycle-1.19/t/cycle.t 2013-08-27 19:21:17.000000000 +0200 @@ -1,6 +1,4 @@ -# $Id$ - -use Test::More tests => 9; +use Test::More; use Tie::Cycle; @@ -8,9 +6,10 @@ tie my $cycle, 'Tie::Cycle', \@array; -foreach( 0 .. 2 ) - { +foreach( 0 .. 2 ) { is( $cycle, $array[0], "Cycle is first element, iteration $_" ); is( $cycle, $array[1], "Cycle is second element, iteration $_" ); is( $cycle, $array[2], "Cycle is third element, iteration $_" ); } + +done_testing(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/t/load.t new/Tie-Cycle-1.19/t/load.t --- old/Tie-Cycle-1.17/t/load.t 2009-01-30 10:48:24.000000000 +0100 +++ new/Tie-Cycle-1.19/t/load.t 2013-08-27 19:21:17.000000000 +0200 @@ -1,5 +1,5 @@ -# $Id$ +use Test::More 0.95; -use Test::More tests => 1; +use_ok( 'Tie::Cycle' ) or BAILOUT(); -use_ok( 'Tie::Cycle' ); +done_testing(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/t/one.t new/Tie-Cycle-1.19/t/one.t --- old/Tie-Cycle-1.17/t/one.t 2009-01-30 10:48:24.000000000 +0100 +++ new/Tie-Cycle-1.19/t/one.t 2013-08-27 19:21:17.000000000 +0200 @@ -1,6 +1,4 @@ -# $Id$ - -use Test::More tests => 3; +use Test::More 0.95; use Tie::Cycle; @@ -11,3 +9,5 @@ is( $cycle, $array[0], "Cycle is first element, iteration 1" ); is( $cycle, $array[0], "Cycle is first element, iteration 2" ); is( $cycle, $array[0], "Cycle is first element, iteration 3" ); + +done_testing(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/t/pod.t new/Tie-Cycle-1.19/t/pod.t --- old/Tie-Cycle-1.17/t/pod.t 2009-01-30 10:48:24.000000000 +0100 +++ new/Tie-Cycle-1.19/t/pod.t 2013-08-27 19:21:17.000000000 +0200 @@ -1,5 +1,4 @@ -# $Id$ -use Test::More; +use Test::More 0.95; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cycle-1.17/t/pod_coverage.t new/Tie-Cycle-1.19/t/pod_coverage.t --- old/Tie-Cycle-1.17/t/pod_coverage.t 2009-01-30 10:48:24.000000000 +0100 +++ new/Tie-Cycle-1.19/t/pod_coverage.t 2013-08-27 19:21:17.000000000 +0200 @@ -1,17 +1,13 @@ -# $Id$ - -use Test::More; +use Test::More 0.95; eval "use Test::Pod::Coverage"; -if( $@ ) - { +if( $@ ) { plan skip_all => "Test::Pod::Coverage required for testing POD"; } -else - { - plan tests => 1; - +else { pod_coverage_ok( "Tie::Cycle", { trustme => [ qr/^[A-Z_]+$/ ] } ); } + +done_testing(); -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
