--- /dev/null
+blib*
+Makefile
+Makefile.old
+Build
+_build*
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+Equinox-Migration-*
+cover_db
--- /dev/null
+Revision history for Equinox-Migration
+
+0.01 Date/time
+ First version, released on an unsuspecting world.
+
--- /dev/null
+Changes
+MANIFEST
+Makefile.PL
+README
+lib/Equinox/Migration.pm
+t/00-load.t
+t/pod-coverage.t
+t/pod.t
--- /dev/null
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Equinox::Migration',
+ AUTHOR => 'Shawn Boyette <sboyette@esilibrary.com>',
+ VERSION_FROM => 'lib/Equinox/Migration.pm',
+ ABSTRACT_FROM => 'lib/Equinox/Migration.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'Equinox-Migration-*' },
+);
--- /dev/null
+Equinox-Migration
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the README
+file from a module distribution so that people browsing the archive
+can use it to get an idea of the module's uses. It is usually a good idea
+to provide version information here so that people can decide whether
+fixes for the module are worth downloading.
+
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the
+perldoc command.
+
+ perldoc Equinox::Migration
+
+You can also look for information at:
+
+ RT, CPAN's request tracker
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=Equinox-Migration
+
+ AnnoCPAN, Annotated CPAN documentation
+ http://annocpan.org/dist/Equinox-Migration
+
+ CPAN Ratings
+ http://cpanratings.perl.org/d/Equinox-Migration
+
+ Search CPAN
+ http://search.cpan.org/dist/Equinox-Migration
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2009 Shawn Boyette
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
--- /dev/null
+package Equinox::Migration;
+
+use warnings;
+use strict;
+
+=head1 NAME
+
+Equinox::Migration - The great new Equinox::Migration!
+
+=head1 VERSION
+
+Version 0.01
+
+=cut
+
+our $VERSION = '0.01';
+
+
+=head1 SYNOPSIS
+
+Quick summary of what the module does.
+
+Perhaps a little code snippet.
+
+ use Equinox::Migration;
+
+ my $foo = Equinox::Migration->new();
+ ...
+
+=head1 EXPORT
+
+A list of functions that can be exported. You can delete this section
+if you don't export anything, such as for a purely object-oriented module.
+
+=head1 FUNCTIONS
+
+=head2 function1
+
+=cut
+
+sub function1 {
+}
+
+=head2 function2
+
+=cut
+
+sub function2 {
+}
+
+=head1 AUTHOR
+
+Shawn Boyette, C<< <sboyette at esilibrary.com> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to C<bug-equinox-migration at rt.cpan.org>, or through
+the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Equinox-Migration>. I will be notified, and then you'll
+automatically be notified of progress on your bug as I make changes.
+
+
+
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+ perldoc Equinox::Migration
+
+
+You can also look for information at:
+
+=over 4
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Equinox-Migration>
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Equinox-Migration>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/Equinox-Migration>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Equinox-Migration>
+
+=back
+
+
+=head1 ACKNOWLEDGEMENTS
+
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2009 Shawn Boyette, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+
+=cut
+
+1; # End of Equinox::Migration
--- /dev/null
+package Equinox::Migration::SimpleTagList;
+
+use warnings;
+use strict;
+
+=head1 NAME
+
+Equinox::Migration::SimpleTagList - Generate taglist from file
+
+=head1 VERSION
+
+Version 1.000
+
+=cut
+
+our $VERSION = '1.000';
+
+
+=head1 SYNOPSIS
+
+Using a file as input, E::M::STL generates a set of MARC tags
+(three-digit, zero-padded integers) and provides several access
+mechanisms to that list.
+
+ use Equinox::Migration::SimpleTagList;
+
+ my $stl = Equinox::Migration::SimpleTagList->new( file => "trashtags.txt" );
+ my $tags = $stl->as_hashref;
+
+or
+
+ my $stl = Equinox::Migration::SimpleTagList->new( file => "trashtags.txt" );
+ if ( $stl->has($foo) ) {
+ # if $foo is an element of $stl's parsed list
+ # do stuff ...
+ }
+
+
+=head1 ROUTINES
+
+
+=head2 new
+
+Takes one argument, C<file>, which is mandatory. Returns a E::M::STL
+object.
+
+=cut
+
+sub new {
+ my ($class,%args) = @_;
+
+ my $self = bless { conf => { except => 0,
+ range => { high => 0, low => 0 },
+ },
+ tags => {} }, $class;
+
+ if (-r $args{file}) {
+ $self->{conf}{file} = $args{file}
+ } else {
+ die "Can't open tags file: $!\n";
+ }
+
+ $self->generate;
+ return $self;
+}
+
+
+
+=head2 has
+
+Passed a data field tag, returns 1 if that tag is in the list and 0 if
+it is not.
+
+=cut
+
+sub has { my ($self, $t) = @_; return (defined $self->{tags}{$t}) ? 1 : 0 }
+
+=head2 as_hashref
+
+Returns a hashref of the entire, assembled tag list.
+
+=cut
+
+sub as_hashref { my ($self) = @_; return $self->{tags} }
+
+=head2 as_hashref
+
+Returns a listref of the entire, assembled tag list.
+
+=cut
+
+sub as_listref { my ($self) = @_; return \(keys %{$self->{tags}}) }
+
+sub generate {
+ my ($self) = @_;
+
+ open TAGFILE, '<', $self->{conf}{file};
+ while (<TAGFILE>) {
+ my $lastwasrange = 0;
+ $self->{conf}{range}{high} = 0;
+ $self->{conf}{range}{low} = 0;
+ $self->{conf}{except} = 0;
+
+ my @chunks = split /\s+/;
+ while (my $chunk = shift @chunks) {
+
+ # single values
+ if ($chunk =~ /^\d{1,3}$/) {
+ $self->add_tag($chunk);
+ $lastwasrange = 0;
+ next;
+ }
+
+ # ranges
+ if ($chunk =~ /^\d{1,3}\.\.\d{1,3}$/) {
+ my ($low, $high) = $self->add_range($chunk);
+ $lastwasrange = 1;
+ unless ($self->{conf}{except}) {
+ $self->{conf}{range}{high} = $high;
+ $self->{conf}{range}{low} = $low;
+ }
+ next;
+ }
+
+ # 'except'
+ if ($chunk eq 'except') {
+ die "Keyword 'except' can only follow a range (line $.)\n"
+ unless $lastwasrange;
+ die "Keyword 'except' may only occur once per line (line $.)\n"
+ if $self->{conf}{except};
+ $$self->{conf}{except} = 1;
+ next;
+ }
+
+ die "Unknown chunk $chunk in tags file (line $.)\n";
+ }
+ }
+}
+
+=head2 add_range
+
+=cut
+
+sub add_range {
+ my ($self, $chunk) = @_;
+ my ($low,$high) = split /\.\./, $chunk;
+ die "Ranges must be 'low..high' ($low is greater than $high on line $.)\n"
+ if ($low > $high);
+ if ($self->{conf}{except}) {
+ die "Exception ranges must be within last addition range (line $.)\n"
+ if ($low < $self->{range}{low} or $high > $self->{range}{high});
+ }
+ for my $tag ($low..$high) {
+ $self->add_tag($tag)
+ }
+ return $low, $high;
+}
+
+=head2 add_tag
+
+=cut
+
+sub add_tag {
+ my ($self, $tag) = @_;
+
+ die "Values must be valid tags (000-999)\n"
+ unless ($tag >= 0 and $tag <= 999);
+
+ if ($self->{conf}{except}) {
+ delete $self->{tags}{$tag};
+ } else {
+ die "Trash tag '$tag' specified twice (line $.)\n"
+ if $self->{tags}{$tag};
+ $self->{tags}{$tag} = 1;
+ }
+}
+
+
+=head1 AUTHOR
+
+Shawn Boyette, C<< <sboyette at esilibrary.com> >>
+
+=head1 TODO
+
+=over
+
+=item * Remove single-except rule?
+
+=back
+
+=head1 BUGS
+
+Please report any bugs or feature requests to the above email address.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+ perldoc Equinox::Migration::TrashTags
+
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2009 Shawn Boyette, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+
+=cut
+
+1; # End of Equinox::Migration::SimpleTagList
--- /dev/null
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'Equinox::Migration' );
+}
+
+diag( "Testing Equinox::Migration $Equinox::Migration::VERSION, Perl $], $^X" );
--- /dev/null
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+sub not_in_file_ok {
+ my ($filename, %regex) = @_;
+ open( my $fh, '<', $filename )
+ or die "couldn't open $filename for reading: $!";
+
+ my %violated;
+
+ while (my $line = <$fh>) {
+ while (my ($desc, $regex) = each %regex) {
+ if ($line =~ $regex) {
+ push @{$violated{$desc}||=[]}, $.;
+ }
+ }
+ }
+
+ if (%violated) {
+ fail("$filename contains boilerplate text");
+ diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
+ } else {
+ pass("$filename contains no boilerplate text");
+ }
+}
+
+sub module_boilerplate_ok {
+ my ($module) = @_;
+ not_in_file_ok($module =>
+ 'the great new $MODULENAME' => qr/ - The great new /,
+ 'boilerplate description' => qr/Quick summary of what the module/,
+ 'stub function definition' => qr/function[12]/,
+ );
+}
+
+TODO: {
+ local $TODO = "Need to replace the boilerplate text";
+
+ not_in_file_ok(README =>
+ "The README is used..." => qr/The README is used/,
+ "'version information here'" => qr/to provide version information/,
+ );
+
+ not_in_file_ok(Changes =>
+ "placeholder date/time" => qr(Date/time)
+ );
+
+ module_boilerplate_ok('lib/Equinox/Migration.pm');
+
+
+}
+
--- /dev/null
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod::Coverage
+my $min_tpc = 1.08;
+eval "use Test::Pod::Coverage $min_tpc";
+plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
+ if $@;
+
+# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
+# but older versions don't recognize some common documentation styles
+my $min_pc = 0.18;
+eval "use Pod::Coverage $min_pc";
+plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
+ if $@;
+
+all_pod_coverage_ok();
--- /dev/null
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();