From: Rafael Kitover Date: Mon, 12 Jul 2010 23:21:40 +0000 (+0000) Subject: add failing tests for punctuation in $field, remove unnecessary Win32 check and updat... X-Git-Tag: v0.09004~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8ef9b3ff970550236c6846c7d446e3bf09ae0a66;p=p5sagit%2FClass-Accessor-Grouped.git add failing tests for punctuation in $field, remove unnecessary Win32 check and update POD --- diff --git a/lib/Class/Accessor/Grouped.pm b/lib/Class/Accessor/Grouped.pm index e91b106..559458d 100644 --- a/lib/Class/Accessor/Grouped.pm +++ b/lib/Class/Accessor/Grouped.pm @@ -10,22 +10,16 @@ use Sub::Name (); our $VERSION = '0.09003'; $VERSION = eval $VERSION; -# Class::XSAccessor is segfaulting on win32, so be careful -# Win32 users can set $hasXS to try to use it anyway - our $hasXS; sub _hasXS { - if (not defined $hasXS) { $hasXS = 0; - if ($^O ne 'MSWin32') { - eval { - require Class::XSAccessor; - $hasXS = 1; - }; - } + eval { + require Class::XSAccessor; + $hasXS = 1; + }; } return $hasXS; @@ -467,20 +461,16 @@ sub get_super_paths { =head1 PERFORMANCE You can speed up accessors of type 'simple' by installing L. -Note however that the use of this module is disabled by default on Win32 -systems, as it causes yet unresolved segfaults. If you are a Win32 user, and -want to try this module with L, set -C<$Class::Accessor::Grouped::hasXS> to a true value B registering -your accessors (e.g. in a C block) =head1 AUTHORS Matt S. Trout Christopher H. Laco -With contributions from: +=head1 CONTRIBUTORS -Guillermo Roditi +groditi: Guillermo Roditi +ribasushi: Peter Rabbitson =head1 COPYRIGHT & LICENSE diff --git a/t/accessors.t b/t/accessors.t index ddd5aa4..edd11ca 100644 --- a/t/accessors.t +++ b/t/accessors.t @@ -72,7 +72,8 @@ foreach (qw/singlefield multiple1 multiple2/) { foreach (qw/lr1 lr2/) { my $name = "$_".'name'; my $alias = "_${name}_accessor"; - my $field = "$_".'field'; + + my $field = { lr1 => 'lr1;field', lr2 => q{lr2'field} }->{$_}; can_ok($class, $name, $alias); ok(!$class->can($field)); @@ -98,4 +99,3 @@ foreach (qw/lr1 lr2/) { }; 1; - diff --git a/t/accessors_ro.t b/t/accessors_ro.t index bde31c9..6b543ed 100644 --- a/t/accessors_ro.t +++ b/t/accessors_ro.t @@ -59,7 +59,7 @@ foreach (qw/singlefield multiple1 multiple2/) { foreach (qw/lr1 lr2/) { my $name = "$_".'name'; my $alias = "_${name}_accessor"; - my $field = "$_".'field'; + my $field = { lr1 => 'lr1;field', lr2 => q{lr2'field} }->{$_}; can_ok($class, $name, $alias); ok(!$class->can($field)); diff --git a/t/accessors_wo.t b/t/accessors_wo.t index 6700eb2..bc5307c 100644 --- a/t/accessors_wo.t +++ b/t/accessors_wo.t @@ -53,7 +53,8 @@ foreach (qw/singlefield multiple1 multiple2/) { foreach (qw/lr1 lr2/) { my $name = "$_".'name'; my $alias = "_${name}_accessor"; - my $field = "$_".'field'; + + my $field = { lr1 => 'lr1;field', lr2 => q{lr2'field} }->{$_}; can_ok($class, $name, $alias); ok(!$class->can($field)); diff --git a/t/accessors_xs.t b/t/accessors_xs.t index 68091a2..672dafd 100644 --- a/t/accessors_xs.t +++ b/t/accessors_xs.t @@ -5,14 +5,9 @@ use File::Spec::Functions; use Test::More; use lib 't/lib'; -BEGIN { - # Enable XSAccessor check - $Class::Accessor::Grouped::hasXS = undef; - - require AccessorGroups; -} +use AccessorGroups (); plan skip_all => 'Class::XSAccessor not available' unless Class::Accessor::Grouped::_hasXS(); -require( catfile($Bin, 'accessors.t') ); \ No newline at end of file +require( catfile($Bin, 'accessors.t') ); diff --git a/t/lib/AccessorGroups.pm b/t/lib/AccessorGroups.pm index 52dabe4..0fb5a7c 100644 --- a/t/lib/AccessorGroups.pm +++ b/t/lib/AccessorGroups.pm @@ -5,7 +5,7 @@ use base 'Class::Accessor::Grouped'; __PACKAGE__->mk_group_accessors('simple', 'singlefield'); __PACKAGE__->mk_group_accessors('simple', qw/multiple1 multiple2/); -__PACKAGE__->mk_group_accessors('simple', [qw/lr1name lr1field/], [qw/lr2name lr2field/]); +__PACKAGE__->mk_group_accessors('simple', [qw/lr1name lr1;field/], [qw/lr2name lr2'field/]); __PACKAGE__->mk_group_accessors('component_class', 'result_class'); sub new { diff --git a/t/lib/AccessorGroupsRO.pm b/t/lib/AccessorGroupsRO.pm index 688a7c8..3cb8a1c 100644 --- a/t/lib/AccessorGroupsRO.pm +++ b/t/lib/AccessorGroupsRO.pm @@ -5,7 +5,7 @@ use base 'Class::Accessor::Grouped'; __PACKAGE__->mk_group_ro_accessors('single', 'singlefield'); __PACKAGE__->mk_group_ro_accessors('multiple', qw/multiple1 multiple2/); -__PACKAGE__->mk_group_ro_accessors('listref', [qw/lr1name lr1field/], [qw/lr2name lr2field/]); +__PACKAGE__->mk_group_ro_accessors('listref', [qw/lr1name lr1;field/], [qw/lr2name lr2'field/]); sub new { return bless {}, shift;