use warnings;
use base 'Exporter';
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use 5.006;
+if ($ENV{SHIKA_DEBUG}) {
+ *DEBUG = sub (){ 1 };
+} else {
+ *DEBUG = sub (){ 0 };
+}
+
+our $PurePerl;
+$PurePerl = $ENV{SHIKA_PUREPERL} unless defined $PurePerl;
+
+
+if (! $PurePerl) {
+ local $@;
+ local $^W = 0;
+ require XSLoader;
+ $PurePerl = !eval{ XSLoader::load(__PACKAGE__, $VERSION); 1 };
+ warn "Failed to load XS mode: $@" if $@ && Mouse::DEBUG();
+}
+
+
use Carp 'confess';
use Mouse::Util 'blessed';
my $meta = Mouse::Meta::Class->initialize(caller);
my $role = shift;
+ my $args = shift || {};
- confess "Mouse::Role only supports 'with' on individual roles at a time" if @_;
+ confess "Mouse::Role only supports 'with' on individual roles at a time" if @_ || !ref $args;
Mouse::load_class($role);
- $role->meta->apply($meta);
+ $role->meta->apply($meta, %$args);
}
sub import {
bucket status). You must specify an appropriate type constraint to use
auto_deref.
+=item lazy_build => 0|1
+
+Automatically define lazy => 1 as well as builder => "_build_$attr", clearer =>
+"clear_$attr', predicate => 'has_$attr' unless they are already defined.
+
=back
=head2 confess error -> BOOM