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;
=head1 PERFORMANCE
You can speed up accessors of type 'simple' by installing L<Class::XSAccessor>.
-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<Class::XSAccessor>, set
-C<$Class::Accessor::Grouped::hasXS> to a true value B<before> registering
-your accessors (e.g. in a C<BEGIN> block)
=head1 AUTHORS
Matt S. Trout <mst@shadowcatsystems.co.uk>
Christopher H. Laco <claco@chrislaco.com>
-With contributions from:
+=head1 CONTRIBUTORS
-Guillermo Roditi <groditi@cpan.org>
+groditi: Guillermo Roditi <groditi@cpan.org>
+ribasushi: Peter Rabbitson <ribasushi@cpan.org>
=head1 COPYRIGHT & LICENSE
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));
};
1;
-
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));
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));
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') );
__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 {
__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;