# $Id$
use strict;
use warnings;
-use inc::Module::Install 0.91;
+use inc::Module::Install 1;
name 'Class-Accessor-Grouped';
license 'perl';
requires 'Class::Inspector';
requires 'Sub::Name' => '0.04';
-# removed due to segfaults, see _hasXS()
-#requires 'Class::XSAccessor';
-
test_requires 'Sub::Identify';
+test_requires 'Test::Exception';
clean_files "Class-Accessor-Grouped-* t/var";
if (-e 'MANIFEST.SKIP') {
system('pod2text lib/Class/Accessor/Grouped.pm > README');
+ realclean_files 'README';
}
-realclean_files 'README';
-
-auto_provides;
auto_install;
resources repository =>
use Test::More tests => 8;
+use Test::Exception;
use strict;
use warnings;
use lib 't/lib';
use Class::Inspector;
-use AccessorGroups;
+use AccessorGroupsComp;
-is(AccessorGroups->result_class, undef);
+is(AccessorGroupsComp->result_class, undef);
## croak on set where class can't be loaded and it's a physical class
-my $dying = AccessorGroups->new;
-eval {
+my $dying = AccessorGroupsComp->new;
+throws_ok {
$dying->result_class('NotReallyAClass');
-};
-ok($@ =~ /Could not load result_class 'NotReallyAClass'/);
+} qr/Could not load result_class 'NotReallyAClass'/;
is($dying->result_class, undef);
is($dying->result_class, 'JunkiesNeverInstalled');
ok(!Class::Inspector->loaded('BaseInheritedGroups'));
-AccessorGroups->result_class('BaseInheritedGroups');
+AccessorGroupsComp->result_class('BaseInheritedGroups');
ok(Class::Inspector->loaded('BaseInheritedGroups'));
-is(AccessorGroups->result_class, 'BaseInheritedGroups');
+is(AccessorGroupsComp->result_class, 'BaseInheritedGroups');
## unset it
-AccessorGroups->result_class(undef);
-is(AccessorGroups->result_class, undef);
\ No newline at end of file
+AccessorGroupsComp->result_class(undef);
+is(AccessorGroupsComp->result_class, undef);
use Test::More tests => 36;
+use Test::Exception;
use strict;
use warnings;
use lib 't/lib';
# croak on get/set on non hash-based object
my $dying = NotHashBased->new;
-eval {
+throws_ok {
$dying->killme;
-};
-ok($@ =~ /Cannot get.*is not hash-based/);
+} qr/Cannot get.*is not hash-based/;
-eval {
+throws_ok {
$dying->killme('foo');
-};
-ok($@ =~ /Cannot set.*is not hash-based/);
+} qr/Cannot set.*is not hash-based/;
# make sure we're get defined items, even 0, ''
BaseInheritedGroups->basefield('base');
__PACKAGE__->mk_group_accessors('simple', 'singlefield');
__PACKAGE__->mk_group_accessors('simple', qw/multiple1 multiple2/);
__PACKAGE__->mk_group_accessors('simple', [qw/lr1name lr1;field/], [qw/lr2name lr2'field/]);
-__PACKAGE__->mk_group_accessors('component_class', 'result_class');
sub new {
return bless {}, shift;
--- /dev/null
+package AccessorGroupsComp;
+use strict;
+use warnings;
+use base 'Class::Accessor::Grouped';
+
+__PACKAGE__->mk_group_accessors('component_class', 'result_class');
+
+sub new {
+ return bless {}, shift;
+};
+
+1;