Revision history for Perl extension Moose
0.34
- ~~ some doc fixes ~~
+ ~~ more misc. doc fixes ~~
+
+ * Moose::Meta::Method::Accessor
+ - fixed bug when passing a list of values to
+ an accessor would get (incorrectly) ignored.
+ Thanks to Sartak for finding this ;)
+ - added tests for this (Sartak again)
0.33 Fri. Dec. 14, 2007
!! Moose now loads 2 x faster !!
use Carp 'confess';
-our $VERSION = '0.08';
+our $VERSION = '0.09';
our $AUTHORITY = 'cpan:STEVAN';
use base 'Moose::Meta::Method',
my $code = 'sub { ' . "\n"
. $self->_inline_pre_body(@_) . "\n"
- . 'if (scalar(@_) == 2) {' . "\n"
+ . 'if (scalar(@_) >= 2) {' . "\n"
. $self->_inline_copy_value . "\n"
. $self->_inline_check_required . "\n"
. $self->_inline_check_coercion . "\n"
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More tests => 12;
use Test::Exception;
BEGIN {
[],
'... got the right dereferenced value'
);
-}
\ No newline at end of file
+}
+
+{
+ package AutoDeref;
+ use Moose;
+
+ has 'bar' => (
+ is => 'rw',
+ isa => 'ArrayRef[Int]',
+ auto_deref => 1,
+ );
+}
+
+{
+ my $autoderef = AutoDeref->new;
+
+ dies_ok {
+ $autoderef->bar(1, 2, 3);
+ } '... its auto-de-ref-ing, not auto-en-ref-ing';
+
+ lives_ok {
+ $autoderef->bar([ 1, 2, 3 ])
+ } '... set the results of bar correctly';
+
+ is_deeply [ $autoderef->bar ], [ 1, 2, 3 ], '... auto-dereffed correctly';
+}
use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More tests => 22;
use Test::Exception;
BEGIN {
[[ 1, 2, 3 ], [ qw/foo bar/ ]]
), '... [[ 1, 2, 3 ], [ qw/foo bar/ ]] failed successfully');
-{
- package AutoDeref;
- use Moose;
- use Moose::Util::TypeConstraints;
- has 'bar' => (
- is => 'rw',
- isa => 'ArrayRef[Int]',
- auto_deref => 1,
- );
-}
-
-my $autoderef = AutoDeref->new;
-lives_ok { $autoderef->bar(1, 2, 3) };
-is_deeply [ $autoderef->bar ], [1, 2, 3];
-
-dies_ok { $autoderef->bar(1, "foo", 3) };