From: Peter Rabbitson Date: Sat, 24 Apr 2010 09:52:09 +0000 (+0000) Subject: Do as Steffen says X-Git-Tag: v0.09004~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=96bd933727f6f14411aeec6c50cf8360ee4a1177;p=p5sagit%2FClass-Accessor-Grouped.git Do as Steffen says --- diff --git a/Changes b/Changes index e3d2cc1..b473dc3 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Class::Accessor::Grouped. + - Changed the way Class::XSAccessor is invoked if available + (recommended by C::XSA author) + 0.09003 Fri Apr 23 23:00:19 2010 - use Class::XSAccessor if available for 'simple' accessors, except on MSWin32, with documentation diff --git a/lib/Class/Accessor/Grouped.pm b/lib/Class/Accessor/Grouped.pm index c87cd05..fd36786 100644 --- a/lib/Class/Accessor/Grouped.pm +++ b/lib/Class/Accessor/Grouped.pm @@ -103,13 +103,16 @@ sub mk_group_accessors { my $alias = "_${name}_accessor"; my $full_name = join('::', $class, $name); my $full_alias = join('::', $class, $alias); - if ( $hasXS && $group eq 'simple' ) { require Class::XSAccessor; - Class::XSAccessor::newxs_accessor("${class}::${name}", $field, 0); - Class::XSAccessor::newxs_accessor("${class}::${alias}", $field, 0); - - # XXX: is the alias accessor really necessary? + Class::XSAccessor->import({ + replace => 1, + class => $class, + accessors => { + $name => $field, + $alias => $field, + }, + }); } else { my $accessor = $self->$maker($group, $field);