'accessor' method is not defined when using 'is'
and 'accessor' option. But 'accessor' method is defined
when not using 'is' option and using 'writer' and 'accessor'
options.
Here is test code.
#!/usr/bin/env perl
package MouseObj;
use Mouse 0.78;
has 'only_accessor' => (
is => 'rw',
isa => 'Int',
accessor => 'only_accessor_accessor',
);
has 'accesor_and_writer' => (
is => 'rw',
isa => 'Int',
accessor => 'accesor_and_writer_accessor',
writer => 'accesor_and_writer_writer',
);
has 'not_with_is' => (
isa => 'Int',
accessor => 'not_with_is_accessor',
);
package main;
use strict;
use warnings;
use Test::More;
can_ok('MouseObj', 'only_accessor_accessor');
can_ok('MouseObj', 'accesor_and_writer_accessor');
can_ok('MouseObj', 'accesor_and_writer_writer');
can_ok('MouseObj', 'not_with_is_accessor');
done_testing;
__END__
Here is result.
not ok 1 - MouseObj->can('only_accessor_accessor')
# Failed test 'MouseObj->can('only_accessor_accessor')'
# at mouse_bug.pl line 29.
# MouseObj->can('only_accessor_accessor') failed
ok 2 - MouseObj->can('accesor_and_writer_accessor')
ok 3 - MouseObj->can('accesor_and_writer_writer')
ok 4 - MouseObj->can('not_with_is_accessor')
1..4
# Looks like you failed 1 test of 4.
[Environment]
% perl -v
This is perl 5, version 12, subversion 2 (v5.12.2) built
for darwin-2level
% uname -a
Darwin 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT
2010; root:xnu-1504.7.4~1/RELEASE_I386 i386
I test Mouse-0.79 also, this test is still failed.
Case of using Moose in place of Mouse, all tests are passed.
--
Syohei Yoshida