From: Christopher H. Laco Date: Sun, 6 May 2007 02:24:39 +0000 (+0000) Subject: Converted to Module::Install X-Git-Tag: v0.04000^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e1eaa4ae536c924201a522c3398c75c4f2104b0e;p=p5sagit%2FClass-Accessor-Grouped.git Converted to Module::Install Added culterific tests/TEST_AUTHOR Converted to distro friendly version number --- diff --git a/Build.PL b/Build.PL index 1d43468..2316616 100644 --- a/Build.PL +++ b/Build.PL @@ -1,20 +1,2 @@ -#!/usr/bin/perl -use warnings; -use strict; -use Module::Build; - -Module::Build->new( - module_name => 'Class::Accessor::Grouped', - dist_author => [ - 'Matt S. Trout ', - 'Christopher H. Laco ' - ], - license => 'perl', - requires => { - 'Carp' => 0, - 'Scalar::Util' => 0, - 'Class::ISA' => 0 - }, - create_makefile_pl => 'passthrough', - create_readme => 1, -)->create_build_script; +# $Id$ +require 'Makefile.PL'; \ No newline at end of file diff --git a/Changes b/Changes index 9663152..cd365bc 100644 --- a/Changes +++ b/Changes @@ -1,8 +1,14 @@ Revision history for Class::Accessor::Grouped. +0 04000 Sat May 05 21:17:23 2007 + - Converted to Module::Install + - Added culterific tests/TEST_AUTHOR + - Converted to distro friendly version number + 0.03 2006-11-07 21:33::35 - big speedup for get_inherited - - get_inherited now checks the current class first before calculating super_path + - get_inherited now checks the current class first before calculating + super_path - get_inherited now caches super_path results 0.02 2006-06-26 19:23:13 @@ -11,3 +17,4 @@ Revision history for Class::Accessor::Grouped. 0.01 2006-06-26 17:38:23 - initial release + diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index 5fc4403..0000000 --- a/MANIFEST +++ /dev/null @@ -1,20 +0,0 @@ -Build.PL -Changes -lib/Class/Accessor/Grouped.pm -Makefile.PL -MANIFEST This list of files -MANIFEST.SKIP -META.yml -README -t/accessors.t -t/accessors_ro.t -t/accessors_wo.t -t/inherited.t -t/lib/AccessorGroups.pm -t/lib/AccessorGroupsRO.pm -t/lib/AccessorGroupsWO.pm -t/lib/BaseInheritedGroups.pm -t/lib/NotHashBased.pm -t/lib/SuperInheritedGroups.pm -t/pod-coverage.t -t/pod.t diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index e9d92b5..e01f9fb 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -19,6 +19,7 @@ aegis.log$ # Avoid Module::Build generated and utility files. \bBuild$ \b_build +Build.PL Build.bat # Avoid temp and backup files. diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..449ad45 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,23 @@ +# $Id$ +use strict; +use warnings; +use inc::Module::Install 0.65; + +name 'Class-Accessor-Grouped'; +license 'perl'; +perl_version '5.006001'; +all_from 'lib/Class/Accessor/Grouped.pm'; + +requires 'Carp'; +requires 'Scalar::Util'; +requires 'Class::ISA'; + +tests "t/*.t t/*/*.t"; +clean_files "Class-Accessor-Grouped-* t/var"; + +eval { + system 'pod2text lib/Class/Accessor/Grouped.pm > README'; +}; + +auto_install; +WriteAll; diff --git a/README b/README new file mode 100644 index 0000000..2f94656 --- /dev/null +++ b/README @@ -0,0 +1,107 @@ +NAME + Class::Accessor::Grouped - Lets you build groups of accessors + +SYNOPSIS +DESCRIPTION + This class lets you build groups of accessors that will call different + getters and setters. + +METHODS + mk_group_accessors + Arguments: $group, @fieldspec + Returns: none + + Creates a set of accessors in a given group. + + $group is the name of the accessor group for the generated accessors; + they will call get_$group($field) on get and set_$group($field, $value) + on set. + + @fieldspec is a list of field/accessor names; if a fieldspec is a scalar + this is used as both field and accessor name, if a listref it is + expected to be of the form [ $accessor, $field ]. + + mk_group_ro_accessors + Arguments: $group, @fieldspec + Returns: none + + Creates a set of read only accessors in a given group. Identical to + but accessors will throw an error if passed a + value rather than setting the value. + + mk_group_wo_accessors + Arguments: $group, @fieldspec + Returns: none + + Creates a set of write only accessors in a given group. Identical to + but accessors will throw an error if not passed + a value rather than getting the value. + + make_group_accessor + Arguments: $group, $field + Returns: $sub (\CODE) + + Returns a single accessor in a given group; called by mk_group_accessors + for each entry in @fieldspec. + + make_group_ro_accessor + Arguments: $group, $field + Returns: $sub (\CODE) + + Returns a single read-only accessor in a given group; called by + mk_group_ro_accessors for each entry in @fieldspec. + + make_group_wo_accessor + Arguments: $group, $field + Returns: $sub (\CODE) + + Returns a single write-only accessor in a given group; called by + mk_group_wo_accessors for each entry in @fieldspec. + + get_simple + Arguments: $field + Returns: $value + + Simple getter for hash-based objects which returns the value for the + field name passed as an argument. + + set_simple + Arguments: $field, $new_value + Returns: $new_value + + Simple setter for hash-based objects which sets and then returns the + value for the field name passed as an argument. + + get_inherited + Arguments: $field + Returns: $value + + Simple getter for Classes and hash-based objects which returns the value + for the field name passed as an argument. This behaves much like + Class::Data::Accessor where the field can be set in a base class, + inherited and changed in subclasses, and inherited and changed for + object instances. + + set_inherited + Arguments: $field, $new_value + Returns: $new_value + + Simple setter for Classes and hash-based objects which sets and then + returns the value for the field name passed as an argument. When called + on a hash-based object it will set the appropriate hash key value. When + called on a class, it will set a class level variable. + + Note:: This method will die if you try to set an object variable on a + non hash-based object. + + get_super_paths + Returns a list of 'parent' or 'super' class names that the current class + inherited from. + +AUTHORS + Matt S. Trout Christopher H. Laco + + +LICENSE + You may distribute this code under the same terms as Perl itself. + diff --git a/lib/Class/Accessor/Grouped.pm b/lib/Class/Accessor/Grouped.pm index 94a1281..978ff1d 100644 --- a/lib/Class/Accessor/Grouped.pm +++ b/lib/Class/Accessor/Grouped.pm @@ -6,7 +6,7 @@ use Class::ISA; use Scalar::Util qw/blessed reftype/; use vars qw($VERSION); -$VERSION = '0.03'; +$VERSION = '0.04000'; =head1 NAME diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..80ab482 --- /dev/null +++ b/t/basic.t @@ -0,0 +1,11 @@ +#!perl -wT +# $Id$ +use strict; +use warnings; + +BEGIN { + use lib 't/lib'; + use Test::More tests => 1; + + use_ok('Class::Accessor::Grouped'); +}; diff --git a/t/manifest.t b/t/manifest.t new file mode 100644 index 0000000..008ec31 --- /dev/null +++ b/t/manifest.t @@ -0,0 +1,22 @@ +#!perl -wT +# $Id$ +use strict; +use warnings; + +BEGIN { + use lib 't/lib'; + use Test::More; + + plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR}; + + eval 'use Test::CheckManifest 0.09'; + if($@) { + plan skip_all => 'Test::CheckManifest 0.09 not installed'; + }; +}; + +ok_manifest({ + exclude => ['/t/var', '/cover_db'], + filter => [qr/\.svn/, qr/cover/, qr/Build(.(PL|bat))?/, qr/_build/], + bool => 'or' +}); diff --git a/t/pod-coverage.t b/t/pod-coverage.t deleted file mode 100644 index 2c5ca56..0000000 --- a/t/pod-coverage.t +++ /dev/null @@ -1,4 +0,0 @@ -use Test::More; -eval "use Test::Pod::Coverage 1.00"; -plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@; -all_pod_coverage_ok(); diff --git a/t/pod-spelling.t b/t/pod-spelling.t deleted file mode 100644 index d52e03b..0000000 --- a/t/pod-spelling.t +++ /dev/null @@ -1,25 +0,0 @@ -use Test::More; -eval 'use Test::Spelling 0.11'; -plan skip_all => 'Test::Spelling 0.11 not installed' if $@; -plan skip_all => 'set TEST_SPELLING to enable this test' unless $ENV{TEST_SPELLING}; - -set_spell_cmd('aspell list'); - -add_stopwords(); - -all_pod_files_spelling_ok(); - -__DATA__ -Bowden -Raygun -isa -mst -behaviour -further -overridable -Laco -Pauley -claco -stylings -fieldspec -listref diff --git a/t/pod.t b/t/pod.t deleted file mode 100644 index 437887a..0000000 --- a/t/pod.t +++ /dev/null @@ -1,4 +0,0 @@ -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(); diff --git a/t/pod_coverage.t b/t/pod_coverage.t new file mode 100644 index 0000000..966a5c6 --- /dev/null +++ b/t/pod_coverage.t @@ -0,0 +1,23 @@ +#!perl -wT +# $Id$ +use strict; +use warnings; + +BEGIN { + use lib 't/lib'; + use Test::More; + + plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR}; + + eval 'use Test::Pod::Coverage 1.04'; + plan skip_all => 'Test::Pod::Coverage 1.04' if $@; + + eval 'use Pod::Coverage 0.14'; + plan skip_all => 'Pod::Coverage 0.14 not installed' if $@; +}; + +my $trustme = { + trustme => [qr/^(g|s)et_component_class$/] +}; + +all_pod_coverage_ok($trustme); diff --git a/t/pod_spelling.t b/t/pod_spelling.t new file mode 100644 index 0000000..ac83037 --- /dev/null +++ b/t/pod_spelling.t @@ -0,0 +1,35 @@ +#!perl -w +# $Id$ +use strict; +use warnings; + +BEGIN { + use lib 't/lib'; + use Test::More; + + plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR}; + + eval 'use Test::Spelling 0.11'; + plan skip_all => 'Test::Spelling 0.11 not installed' if $@; +}; + +set_spell_cmd('aspell list'); + +add_stopwords(); + +all_pod_files_spelling_ok(); + +__DATA__ +Bowden +Raygun +isa +mst +behaviour +further +overridable +Laco +Pauley +claco +stylings +fieldspec +listref diff --git a/t/pod_syntax.t b/t/pod_syntax.t new file mode 100644 index 0000000..27de7c3 --- /dev/null +++ b/t/pod_syntax.t @@ -0,0 +1,16 @@ +#!perl -wT +# $Id$ +use strict; +use warnings; + +BEGIN { + use lib 't/lib'; + use Test::More; + + plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR}; + + eval 'use Test::Pod 1.00'; + plan skip_all => 'Test::Pod 1.00 not installed' if $@; +}; + +all_pod_files_ok(); diff --git a/t/strict.t b/t/strict.t new file mode 100644 index 0000000..3ef1d59 --- /dev/null +++ b/t/strict.t @@ -0,0 +1,53 @@ +#!perl -wT +# $Id$ +use strict; +use warnings; + +BEGIN { + use lib 't/lib'; + use Test::More; + use File::Find; + use File::Basename; + + plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR}; + + eval 'use Test::Strict'; + plan skip_all => 'Test::Strict not installed' if $@; + plan skip_all => 'Need untaint in newer File::Find' if $] <= 5.006; +}; + +## I hope this can go away if Test::Strict or File::Find::Rule +## finally run under -T. Until then, I'm on my own here. ;-) +my @files; +my %trusted = ( + +); + +find({ wanted => \&wanted, + untaint => 1, + untaint_pattern => qr|^([-+@\w./]+)$|, + untaint_skip => 1, + no_chdir => 1 +}, qw(lib t)); + +sub wanted { + my $name = $File::Find::name; + my $file = fileparse($name); + + return if $name =~ /TestApp/; + + if ($name =~ /\.(pm|pl|t)$/i && !exists($trusted{$file})) { + push @files, $name; + }; +}; + +if (scalar @files) { + plan tests => scalar @files; +} else { + plan tests => 1; + fail 'No perl files found for Test::Strict checks!'; +}; + +foreach (@files) { + strict_ok($_); +}; diff --git a/t/style_no_tabs.t b/t/style_no_tabs.t new file mode 100644 index 0000000..1efcefd --- /dev/null +++ b/t/style_no_tabs.t @@ -0,0 +1,15 @@ +#!perl -wT +# $Id$ +use strict; +use warnings; + +BEGIN { + use Test::More; + + plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR}; + + eval 'use Test::NoTabs 0.03'; + plan skip_all => 'Test::NoTabs 0.03 not installed' if $@; +}; + +all_perl_files_ok('lib'); diff --git a/t/warnings.t b/t/warnings.t new file mode 100644 index 0000000..a8d749d --- /dev/null +++ b/t/warnings.t @@ -0,0 +1,53 @@ +#!perl -wT +# $Id$ +use strict; +use warnings; + +BEGIN { + use lib 't/lib'; + use Test::More; + use File::Find; + use File::Basename; + + plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR}; + + eval 'use Test::Strict 0.05'; + plan skip_all => 'Test::Strict 0.05 not installed' if $@; + plan skip_all => 'Need untaint in newer File::Find' if $] <= 5.006; +}; + +## I hope this can go away if Test::Strict or File::Find::Rule +## finally run under -T. Until then, I'm on my own here. ;-) +my @files; +my %trusted = ( + +); + +find({ wanted => \&wanted, + untaint => 1, + untaint_pattern => qr|^([-+@\w./]+)$|, + untaint_skip => 1, + no_chdir => 1 +}, qw(lib t)); + +sub wanted { + my $name = $File::Find::name; + my $file = fileparse($name); + + return if $name =~ /TestApp/; + + if ($name =~ /\.(pm|pl|t)$/i && !exists($trusted{$file})) { + push @files, $name; + }; +}; + +if (scalar @files) { + plan tests => scalar @files; +} else { + plan tests => 1; + fail 'No perl files found for Test::Strict checks!'; +}; + +foreach (@files) { + warnings_ok($_); +};