Revision history for Mouse
-0.40_06
+0.40_07 Tue Nov 17 18:28:57 2009
+ * Mouse::Util::MetaRole
+ - Implemented, but there are many to be done (gfx)
+
+ * Mouse::Meta::Method::Accessor
+ * Mouse::Meta::Method::Constructor
+ - Fix a bug that default values are not weaken()ed (gfx)
+
+0.40_06 Mon Nov 16 17:21:10 2009
* Shipped with Module::Install::XSUtil 0.17 (gfx)
* Mouse::Object
- BUILDALL and DMELISHALL are no longer called by the default ctr/dtr,
because generated ctrs/dtrs have never call them anyway (gfx)
- new and DESTROY are now in XS (gfx)
-
0.40_05 Mon Nov 2 11:59:01 2009
* Shipped with Module::Install::XSUtil 0.16 (gfx)
use Mouse::Exporter; # enables strict and warnings
-our $VERSION = '0.40_06';
+our $VERSION = '0.40_07';
use Carp qw(confess);
use Scalar::Util qw(blessed);
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SYNOPSIS
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SYNOPSIS
Carp::cluck("$self->canonicalize_args has been deprecated."
. "Use \$self->_process_options instead.")
- if _MOUSE_VERBOSE;
+ if Mouse::Util::_MOUSE_VERBOSE;
return %args;
}
Carp::cluck("$self->create has been deprecated."
. "Use \$meta->add_attribute and \$attr->install_accessors instead.")
- if _MOUSE_VERBOSE;
+ if Mouse::Util::_MOUSE_VERBOSE;
# noop
return $self;
Carp::cluck("$self->clone_parent has been deprecated."
. "Use \$meta->add_attribute and \$attr->install_accessors instead.")
- if _MOUSE_VERBOSE;
+ if Mouse::Util::_MOUSE_VERBOSE;
$self->clone_and_inherited_args($class, $name, %args);
}
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 METHODS
$self->{attributes}{$attr->name} = $attr;
$attr->install_accessors();
- if(_MOUSE_VERBOSE && !$attr->{associated_methods} && ($attr->{is} || '') ne 'bare'){
+ if(Mouse::Util::_MOUSE_VERBOSE && !$attr->{associated_methods} && ($attr->{is} || '') ne 'bare'){
Carp::cluck(qq{Attribute (}.$attr->name.qq{) of class }.$self->name.qq{ has no associated methods (did you mean to provide an "is" argument?)});
}
return $attr;
sub compute_all_applicable_attributes {
Carp::cluck('compute_all_applicable_attributes() has been deprecated')
- if _MOUSE_VERBOSE;
+ if Mouse::Util::_MOUSE_VERBOSE;
return shift->get_all_attributes(@_)
}
my ($class, $instance, %params) = @_;
Carp::cluck('clone_instance has been deprecated. Use clone_object instead')
- if _MOUSE_VERBOSE;
+ if Mouse::Util::_MOUSE_VERBOSE;
return $class->clone_object($instance, %params);
}
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 METHODS
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
$type ||= 'accessor';
- my $accessor = sprintf(qq{#line 1 "%s for %s (%s)"\n}, $type, $name, __FILE__)
+ my $accessor = sprintf(qq{package %s;\n#line 1 "%s for %s (%s)"\n}, $class->name, $type, $name, __FILE__)
. "sub {\n";
if ($type eq 'accessor' || $type eq 'writer') {
$accessor .= "return $slot;\n}\n";
- #print "# class ", $class->name, "\n", $accessor, "\n";
+ #print $accessor, "\n";
my $code;
my $e = do{
local $@;
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
my $init_arg = $attr->init_arg;
my $type_constraint = $attr->type_constraint;
+ my $is_weak_ref = $attr->is_weak_ref;
my $need_coercion;
my $instance_slot = $method_class->_inline_slot('$instance', $key);
$post_process .= "\$checks[$index]->($instance_slot)";
$post_process .= " or $attr_var->verify_type_constraint_error(q{$key}, $instance_slot, $constraint_var);\n";
}
- if($attr->is_weak_ref){
+ if($is_weak_ref){
$post_process .= "Scalar::Util::weaken($instance_slot) if ref $instance_slot;\n";
}
}
$code .= "$instance_slot = $value;\n";
+ if($is_weak_ref){
+ $code .= "Scalar::Util::weaken($instance_slot);\n";
+ }
}
}
elsif ($attr->is_required) {
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
my %METAS;
-if(Mouse::Util::_MOUSE_XS){
+# XXX: work around a warning "useless use of a constant in void context" in 5.6.2
+if(&Mouse::Util::_MOUSE_XS()){
# register meta storage for performance
Mouse::Util::__register_metaclass_storage(\%METAS, 0);
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
if($args{_compiled_type_constraint}){
Carp::cluck("'_compiled_type_constraint' has been deprecated, use 'optimized' instead")
- if _MOUSE_VERBOSE;
+ if Mouse::Util::_MOUSE_VERBOSE;
$check = $args{_compiled_type_constraint};
}
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 DESCRIPTION
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 METHODS
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SEE ALSO
package Mouse::Role;
use Mouse::Exporter; # enables strict and warnings
-our $VERSION = '0.40_06';
+our $VERSION = '0.40_07';
use Carp qw(confess);
use Scalar::Util qw(blessed);
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SYNOPSIS
use strict;
use warnings;
-our $VERSION = '0.40_06';
+our $VERSION = '0.40_07';
our $MouseVersion = $VERSION;
our $MooseVersion = '0.90';
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 SYNOPSIS
sub get_linear_isa($;$); # must be here
BEGIN{
+ # This is used in Mouse::PurePerl
+ Mouse::Exporter->setup_import_methods(
+ as_is => [qw(
+ find_meta
+ does_role
+ resolve_metaclass_alias
+ apply_all_roles
+ english_list
+
+ load_class
+ is_class_loaded
+
+ get_linear_isa
+ get_code_info
+
+ get_code_package
+ get_code_ref
+
+ not_supported
+
+ does meta dump
+ )],
+ groups => {
+ default => [], # export no functions by default
+
+ # The ':meta' group is 'use metaclass' for Mouse
+ meta => [qw(does meta dump)],
+ },
+ );
+
+
# Because Mouse::Util is loaded first in all the Mouse sub-modules,
# XS loader is placed here, not in Mouse.pm.
- our $VERSION = '0.40_06';
+ our $VERSION = '0.40_07';
my $xs = !(exists $INC{'Mouse/PurePerl.pm'} || $ENV{MOUSE_PUREPERL});
use constant _MOUSE_VERBOSE => !!$ENV{MOUSE_VERBOSE};
-Mouse::Exporter->setup_import_methods(
- as_is => [qw(
- find_meta
- does_role
- resolve_metaclass_alias
- apply_all_roles
- english_list
-
- load_class
- is_class_loaded
-
- get_linear_isa
- get_code_info
-
- get_code_package
- get_code_ref
-
- not_supported
-
- does meta dump
- _MOUSE_VERBOSE
- )],
- groups => {
- default => [], # export no functions by default
-
- # The ':meta' group is 'use metaclass' for Mouse
- meta => [qw(does meta dump _MOUSE_VERBOSE)],
- },
-);
-
# aliases as public APIs
# it must be 'require', not 'use', because Mouse::Meta::Module depends on Mouse::Util
require Mouse::Meta::Module; # for the entities of metaclass cache utilities
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 IMPLEMENTATIONS FOR
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head2 SYNOPSIS
=head1 VERSION
-This document describes Mouse version 0.40_06
+This document describes Mouse version 0.40_07
=head1 DESCRIPTION
#!perl
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 6;
{
package MyClass;
my $o = MyClass->new();
is($o->weak_with_default, undef);
is($o->lazy_weak_with_default, undef);
+is($o->lazy_weak_with_default, undef);
MyClass->meta->make_immutable();
$o = MyClass->new();
is($o->weak_with_default, undef);
is($o->lazy_weak_with_default, undef);
+is($o->lazy_weak_with_default, undef);
use strict;
use warnings;
+use Test::More;
+
+BEGIN{
+ if($] < 5.008){
+ plan skip_all => "segv happens on 5.6.2";
+ }
+}
use Test::More tests => 4;
use Test::Exception;
{
package NoOpTrait;
use Mouse::Role;
+
+
}
{
package Parent;
- use Mouse -traits => 'NoOpTrait';
+ use Mouse "-traits" => 'NoOpTrait';
has attr => (
is => 'rw',
package Child;
use base 'Parent';
}
-
is(Child->meta->name, 'Child', "correct metaclass name");
-
my $child = Child->new(attr => "ibute");
ok($child, "constructor works");
+
is($child->attr, "ibute", "getter inherited properly");
$child->attr("ition");
#!/usr/bin/env perl
use strict;
use warnings;
+
+use Test::More;
+
+BEGIN{
+ if($] < 5.008){
+ plan skip_all => "segv happens on 5.6.2";
+ }
+}
+
use Test::More tests => 5;
{