use Carp 'confess';
use Scalar::Util 'blessed';
+
use Mouse::Util qw(load_class is_class_loaded);
-use Mouse::Meta::Attribute;
use Mouse::Meta::Module;
use Mouse::Meta::Class;
use Mouse::Meta::Role;
+use Mouse::Meta::Attribute;
use Mouse::Object;
-use Mouse::Util::TypeConstraints;
+use Mouse::Util::TypeConstraints ();
our @EXPORT = qw(extends has before after around override super blessed confess with);
unless $metaclass->isa('Mouse::Meta::Class');
# make a subtype for each Mouse class
- class_type($class)
- unless find_type_constraint($class);
+ Mouse::Util::TypeConstraints::class_type($class)
+ unless Mouse::Util::TypeConstraints::find_type_constraint($class);
my $meta = $metaclass->initialize($class);
$meta->superclasses($base_class)
use strict;
use warnings;
+use Mouse::Util;
+
use Mouse::Meta::TypeConstraint;
use Mouse::Meta::Method::Accessor;
use strict;
use warnings;
-use Mouse::Meta::Method::Constructor;
-use Mouse::Meta::Method::Destructor;
use Scalar::Util qw/blessed weaken/;
+
use Mouse::Util qw/get_linear_isa not_supported/;
+use Mouse::Meta::Method::Constructor;
+use Mouse::Meta::Method::Destructor;
+use Mouse::Meta::Module;
+
use base qw(Mouse::Meta::Module);
sub method_metaclass(){ 'Mouse::Meta::Method' } # required for get_method()
use strict;
use warnings;
-use Mouse::Util qw/get_code_info not_supported load_class/;
+use Carp ();
use Scalar::Util qw/blessed weaken/;
+use Mouse::Util qw/get_code_info not_supported load_class/;
+
{
my %METACLASS_CACHE;
use warnings;
use Mouse::Util qw(not_supported english_list);
+use Mouse::Meta::Module;
+
use base qw(Mouse::Meta::Module);
sub method_metaclass(){ 'Mouse::Meta::Role::Method' } # required for get_method()
package Mouse::Meta::TypeConstraint;
use strict;
use warnings;
-use Carp ();
use overload '""' => sub { shift->{name} }, # stringify to tc name
fallback => 1;
+use Carp ();
+
+use Mouse::Util ();
+
sub new {
my $class = shift;
my %args = @_;
use strict;
use warnings;
+use Mouse::Util;
+
sub new {
my $class = shift;
use warnings;
use base 'Exporter';
-use Carp 'confess', 'croak';
+use Carp 'confess';
use Scalar::Util 'blessed';
-use Mouse::Meta::Role;
-use Mouse::Util qw(load_class);
+use Mouse::Util qw(load_class not_supported);
+use Mouse ();
our @EXPORT = qw(before after around super override inner augment has extends with requires excludes confess blessed);
our %is_removable = map{ $_ => undef } @EXPORT;
my $fullname = "${classname}::${name}";
defined &$fullname
- && confess "Cannot add an override of method '$fullname' " .
- "because there is a local version of '$fullname'";
+ && $meta->throw_error("Cannot add an override of method '$fullname' "
+ . "because there is a local version of '$fullname'");
$meta->add_override_method_modifier($name => sub {
local $Mouse::SUPER_PACKAGE = shift;
# We keep the same errors messages as Moose::Role emits, here.
sub inner {
- croak "Moose::Role cannot support 'inner'";
+ Carp::croak "Roles cannot support 'inner'";
}
sub augment {
- croak "Moose::Role cannot support 'augment'";
+ Carp::croak "Roles cannot support 'augment'";
}
sub has {
$meta->add_attribute($name => \%opts);
}
-sub extends { confess "Roles do not support 'extends'" }
+sub extends {
+ Carp::croak "Roles do not support 'extends'"
+}
sub with {
my $meta = Mouse::Meta::Role->initialize(scalar caller);
sub requires {
my $meta = Mouse::Meta::Role->initialize(scalar caller);
- Carp::croak "Must specify at least one method" unless @_;
+ $meta->throw_error("Must specify at least one method") unless @_;
$meta->add_required_methods(@_);
}
-sub excludes { confess "Mouse::Role does not currently support 'excludes'" }
+sub excludes {
+ not_supported;
+}
sub import {
my $class = shift;
use strict;
use warnings;
use base qw/Exporter/;
+
use Carp qw(confess);
use B ();
use Carp ();
use Scalar::Util qw/blessed looks_like_number openhandle/;
+
+use Mouse::Util;
use Mouse::Meta::TypeConstraint;
our @EXPORT = qw(