Do as Steffen says
Peter Rabbitson [Sat, 24 Apr 2010 09:52:09 +0000 (09:52 +0000)]
Changes
lib/Class/Accessor/Grouped.pm

diff --git a/Changes b/Changes
index e3d2cc1..b473dc3 100644 (file)
--- 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
index c87cd05..fd36786 100644 (file)
@@ -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);