From: Peter Rabbitson Date: Fri, 23 Apr 2010 22:45:35 +0000 (+0000) Subject: XSAccessor fixes X-Git-Tag: v0.09004~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a2537c55439d0f63c5e3d02a721745b395a34f35;p=p5sagit%2FClass-Accessor-Grouped.git XSAccessor fixes --- diff --git a/Changes b/Changes index 8a9e866..ab9d177 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Class::Accessor::Grouped. + - make the Class::XSAccessor more intelligent, add documentation + 0.09002 Tue Oct 20 23:16:28 2009 - removing Class::XSAccessor usage for now diff --git a/lib/Class/Accessor/Grouped.pm b/lib/Class/Accessor/Grouped.pm index b836fb0..008347e 100644 --- a/lib/Class/Accessor/Grouped.pm +++ b/lib/Class/Accessor/Grouped.pm @@ -10,6 +10,25 @@ use Sub::Name (); our $VERSION = '0.09002'; $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; + }; + } + } + + return $hasXS; +} + =head1 NAME Class::Accessor::Grouped - Lets you build groups of accessors @@ -438,29 +457,16 @@ sub get_super_paths { return @{mro::get_linear_isa($class)}; }; -# This is now a hard, rather than optional dep. Since we dep on Sub::Name, we no -# longer care about not using XS modules. +1; -# Class::XSAccessor is segfaulting in some places, so removing for now. -{ - our $hasXS; - - sub _hasXS { 0 } - -# sub _hasXS { -# return $hasXS if defined $hasXS; -# -# $hasXS = 0; -# eval { -# require Class::XSAccessor; -# $hasXS = 1; -# }; -# -# return $hasXS; -# } -} +=head1 Performance -1; +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 untracked 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