List-Rotation-Cycle-1.009/ 0000755 0001750 0001750 00000000000 10757130061 015062 5 ustar pelagic pelagic List-Rotation-Cycle-1.009/t/ 0000755 0001750 0001750 00000000000 10756665645 015351 5 ustar pelagic pelagic List-Rotation-Cycle-1.009/t/test_manifest 0000644 0001750 0001750 00000000071 10744066466 020130 0 ustar pelagic pelagic 00.signature.t
10.load.t
20.cycle.t
pod-coverage.t
pod.t
List-Rotation-Cycle-1.009/t/pod.t 0000644 0001750 0001750 00000000215 10732055364 016277 0 ustar pelagic pelagic use strict;
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok();
List-Rotation-Cycle-1.009/t/00.signature.t 0000644 0001750 0001750 00000001664 10743506626 017751 0 ustar pelagic pelagic use strict;
use Test::More;
if (!$ENV{TEST_SIGNATURE}) {
plan skip_all =>
"Set the environment variable TEST_SIGNATURE to enable this test.";
}
elsif (!eval { require Module::Signature; 1 }) {
plan skip_all =>
"Next time around, consider installing Module::Signature, ".
"so you can verify the integrity of this distribution.";
}
elsif ( !-e 'SIGNATURE' ) {
plan skip_all => "SIGNATURE not found";
}
elsif ( -s 'SIGNATURE' == 0 ) {
plan skip_all => "SIGNATURE file empty";
}
elsif (!eval { require Socket; Socket::inet_aton('pgp.mit.edu') }) {
plan skip_all => "Cannot connect to the keyserver to check module ".
"signature";
}
else {
plan tests => 1;
}
my $ret = Module::Signature::verify();
SKIP: {
skip "Module::Signature cannot verify", 1
if $ret eq Module::Signature::CANNOT_VERIFY();
cmp_ok $ret, '==', Module::Signature::SIGNATURE_OK(), "Valid signature";
}
List-Rotation-Cycle-1.009/t/20.cycle.t 0000644 0001750 0001750 00000001004 10732055341 017024 0 ustar pelagic pelagic use strict;
use Test::More tests => 10;
use List::Rotation::Cycle;
my @array = qw( A B C );
my $c1 = List::Rotation::Cycle->new(@array);
my $c2 = List::Rotation::Cycle->new(@array);
foreach( 1 .. 3 )
{
is( $c1->next, $array[0], "First Cycle is first element, iteration $_" );
is( $c2->next, $array[1], "Second Cycle is second element, iteration $_" );
is( $c1->next, $array[2], "First Cycle is third element, iteration $_" );
}
is( $c2->next, $array[0], "First Cycle is first element" );
List-Rotation-Cycle-1.009/t/pod-coverage.t 0000644 0001750 0001750 00000000255 10732055354 020073 0 ustar pelagic pelagic use strict;
use Test::More;
eval "use Test::Pod::Coverage 0.08";
plan skip_all => "Test::Pod::Coverage 0.08 required for testing POD coverage" if $@;
all_pod_coverage_ok();
List-Rotation-Cycle-1.009/t/10.load.t 0000644 0001750 0001750 00000000112 10732055322 016641 0 ustar pelagic pelagic use strict;
use Test::More tests => 1;
use_ok( 'List::Rotation::Cycle' );
List-Rotation-Cycle-1.009/META.yml 0000644 0001750 0001750 00000001311 10757127740 016341 0 ustar pelagic pelagic --- #YAML:1.0
name: List-Rotation-Cycle
version: 1.009
abstract: Cycle through a list of values via a singleton object implemented as closure.
license: perl
author:
- pelagic
generated_by: ExtUtils::MakeMaker version 6.42
distribution_type: module
requires:
Memoize: 0
Carp: 0
warnings: 0
build_requires:
Test::More: 0
Module::Signature: 0
Test::Pod: 0
Test::Pod::Coverage: 0
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.3.html
version: 1.3
List-Rotation-Cycle-1.009/SIGNATURE 0000644 0001750 0001750 00000002732 10757130061 016352 0 ustar pelagic pelagic This file contains message digests of all files listed in MANIFEST,
signed via the Module::Signature module, version 0.55.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
% cpansign -v
It will check each file's integrity, as well as the signature's
validity. If "==> Signature verified OK! <==" is not displayed,
the distribution may already have been compromised, and you should
not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
SHA1 f645c669ea5622ed3b89c4f8f4468f9ce9310208 Changes
SHA1 e1c41d85339bb015eeb5b9b392db9a1721a5b52f MANIFEST
SHA1 e32c04d4efad4bd0d2d66d85f5779254c4d283a8 META.yml
SHA1 e7ff8454c0bda5c6e80ddce8d3ec15d42ae5f5fc Makefile.PL
SHA1 3236dc1bc3c7deadc81a8a7dc1fd9cdab16d1beb README
SHA1 aa5d41189d29a2b7282467e7837f1a1814d160e2 examples/examples.txt
SHA1 f862f09697aef4b77803d35e4cd2ad636e34d42b lib/List/Rotation/Cycle.pm
SHA1 e201a5e88725f2fea224b90cb74b895fc1844edc t/00.signature.t
SHA1 f726f9caa18a58157607e8fdf1b2b89d8dce1b8f t/10.load.t
SHA1 d67ad3bc17bacf88cd92ff6d20fafe98e5d8e436 t/20.cycle.t
SHA1 a3c5ce63e1da2a0cc8a5c26e1cd00a46b4b0b180 t/pod-coverage.t
SHA1 fada08a138c7f5d0c435fbd184ebfbd975f5da7d t/pod.t
SHA1 af5826bcc36f9bc2380753fcd2166147bf5377ea t/test_manifest
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHvLAxxJDn5Cv7CPcRAnpMAKChsjYdS7e3E44dYM78pS6T7nH9iACeI7ZT
CQbN2F5u05R7ChqQIKD5KN4=
=cfUC
-----END PGP SIGNATURE-----
List-Rotation-Cycle-1.009/README 0000644 0001750 0001750 00000001736 10243175475 015761 0 ustar pelagic pelagic $Id: README,v 1.4 2005/05/19 10:04:56 pelagic Exp pelagic $
You can install this module in the usual Perl way:
perl Makefile.PL
make
make test
make install
The documentation is in the module file. Once you install
the file, you can read it with perldoc:
perldoc List::Rotation::Cycle
If you want to read it before you install it, you can use
perldoc directly on the module file:
perldoc Cycle.pm
You can unistall this module by using something like this:
#!/usr/local/bin/perl -w
use strict;
use ExtUtils::Packlist;
use ExtUtils::Installed;
$ARGV[0] or die "Usage: $0 Module::Name\n";
my $mod = $ARGV[0];
my $inst = ExtUtils::Installed->new();
foreach my $item (sort($inst->files($mod))) {
print "removing $item\n";
unlink $item;
}
my $packfile = $inst->packlist($mod)->packlist_file();
print "removing $packfile\n";
unlink $packfile;
Share and Enjoy,
Imre Saling, pelagic@cpan.org
List-Rotation-Cycle-1.009/Makefile.PL 0000644 0001750 0001750 00000001533 10732052516 017037 0 ustar pelagic pelagic use strict;
use ExtUtils::MakeMaker;
eval "use Test::Manifest";
unless( $@ )
{
* ExtUtils::MM_Any::test_via_harness = sub
{
my($self, $perl, $tests) = @_;
return qq|\t$perl "-MTest::Manifest" | .
qq|"-e" "run_t_manifest(\$(TEST_VERBOSE), '\$(INST_LIB)', | .
qq|'\$(INST_ARCHLIB)')"\n|;
}
}
WriteMakefile(
'NAME' => 'List::Rotation::Cycle',
'VERSION_FROM' => 'lib/List/Rotation/Cycle.pm',
'LICENSE' => 'perl',
'ABSTRACT' => 'Cycle through a list of values via a singleton object implemented as closure. ',
'AUTHOR' => 'pelagic',
'SIGN' => 1,
'PREREQ_PM' => {
'Test::More' => '0',
'Memoize' => '0',
},
'MAN3PODS' => {'lib/List/Rotation/Cycle.pm' => '$(INST_MAN3DIR)/List::Rotation::Cycle.3'},
'clean' => { FILES => 'List-Rotation-Cycle-*' },
);
List-Rotation-Cycle-1.009/MANIFEST 0000644 0001750 0001750 00000000320 10743507360 016213 0 ustar pelagic pelagic Changes
examples/examples.txt
lib/List/Rotation/Cycle.pm
Makefile.PL
MANIFEST This list of files
META.yml
README
SIGNATURE
t/00.signature.t
t/10.load.t
t/20.cycle.t
t/pod-coverage.t
t/pod.t
t/test_manifest
List-Rotation-Cycle-1.009/lib/ 0000755 0001750 0001750 00000000000 10756665645 015654 5 ustar pelagic pelagic List-Rotation-Cycle-1.009/lib/List/ 0000755 0001750 0001750 00000000000 10756665645 016567 5 ustar pelagic pelagic List-Rotation-Cycle-1.009/lib/List/Rotation/ 0000755 0001750 0001750 00000000000 10756665645 020366 5 ustar pelagic pelagic List-Rotation-Cycle-1.009/lib/List/Rotation/Cycle.pm 0000644 0001750 0001750 00000003557 10756665153 021767 0 ustar pelagic pelagic package List::Rotation::Cycle;
use vars qw( $VERSION );
$VERSION = 1.009;
use strict;
use warnings;
use Memoize;
memoize('new');
sub new {
my $class = shift;
do {
require Carp;
Carp::croak ("Incorrect number of arguments; must be >= 1.");
} unless @_ >= 1;
my $self = [ @_ ];
my $closure = sub {
push @$self, shift @$self;
return $self->[-1];
};
bless $closure, $class;
}
sub next {
my $self = shift;
&{ $self };
}
"List::Rotation::Cycle";
__END__
=head1 NAME
List::Rotation::Cycle - Cycle through a list of values via a singleton object implemented as closure.
=head1 SYNOPSIS
use List::Rotation::Cycle;
my @array = qw( A B C );
my $first_cycle = List::Rotation::Cycle->new(@array);
my $second_cycle = List::Rotation::Cycle->new(@array);
print $first_cycle->next; ## prints A
print $second_cycle->next; ## prints B
print $first_cycle->next; ## prints C
print $second_cycle->next; ## prints A, looping back to beginning
=head1 DESCRIPTION
Use C to loop through a list of values.
Once you get to the end of the list, you go back to the beginning.
C is implemented as a Singleton Pattern. You always just
get 1 (the very same) Cycle object even if you use the new method several times.
This is done by using C on the C method. It returns the same object
for every use of C that comes with the same List of parameters.
=head1 OBJECT METHODS
=over 4
=item new
Create a Cycle object for the list of values in the list.
=item next
Return the next element. This method is implemented as a closure.
=back
=head1 AUTHOR
Imre Saling, C<< >>
=head1 COPYRIGHT and LICENSE
Copyright 2000-2004, Imre Saling, All rights reserved.
This software is available under the same terms as perl.
=cut
List-Rotation-Cycle-1.009/Changes 0000644 0001750 0001750 00000001577 10757130000 016360 0 ustar pelagic pelagic Revision history for Perl extension List::Rotation::Cycle
1.003
initial published revision
1.004
* added more tests and META.yml
* The API and methods are not changed. So there is no reason to upgrade from 1.003.
1.009
[INTERNALS]
* Added Memoize to prerequisits
* Changed all perl files to non-executable
* Added SIGNATURE file
* Upgraded META.yml to META-spec-v1.3
* manually added build_prereq to META.yml
* Added a example file (without a real example)
This will be the last supported version of List::Rotation::Cycle
(unless someone finds some bugs).
I suggest you use List::Rotation instead.
The Module List::Rotation also contains a package
List::Rotation::Cycle and some derivatives of it
List::Rotation::Alternate and
List::Rotation::Toggle
List-Rotation-Cycle-1.009/examples/ 0000755 0001750 0001750 00000000000 10756665645 016724 5 ustar pelagic pelagic List-Rotation-Cycle-1.009/examples/examples.txt 0000644 0001750 0001750 00000000232 10730614212 021250 0 ustar pelagic pelagic To see examples for this distribution, it is recommended you read the test
scripts included under ./t. After all this is quite a simple module.
Pelagic