$_REPL->load_plugin('DumpHistory');
use YAML qw/LoadFile DumpFile/;

package Restartable;
use Moose::Role;

has 'is_paused' => (
    is      => 'rw',
    isa     => 'Bool',
    default => 0,
);

# requires 'save_state', 'load_state';

sub stop { 1 }

sub start { 1 }

sub stop_and_start { my $self = shift; $self->start . $self->stop }

package Restartable::ButUnreliable;
use Moose::Role;

with 'Restartable' => {
    -alias => {
        stop  => '_stop',
        start => '_start'
    },
    -excludes => [ 'stop', 'start' ],
};

sub stop {
    my $self = shift;
    $self->_stop();
    $self->explode() if rand(1) > .5;
}

sub start {
    my $self = shift;
    $self->_start();
    $self->explode() if rand(1) > .5;
}

package Restartable::ButBroken;
use Moose::Role;

with 'Restartable' => { -excludes => [ 'stop', 'start' ] };

sub stop {
    my $self = shift;
    $self->explode();
}

sub start {
    my $self = shift;
    $self->explode();
}


package Car;
use Moose;
with 'Restartable::ButUnreliable';

sub explode { "bang" }

package main;

my $c = Car->new;

#package Class;
#
#use Moose;
#
#with 'Role';
#
#package Role;
#
#use Moose::Role;
#
#with 'Activity';
#
#sub role_config {
#	my $self = shift;
#	$self->config;
#}
#
#package Activity;
#
#use Moose::Role;
#
#sub config {
#	1;
#}

#use MooseX::Declare;
#
#class Class with Role {
#	my $config = $self->config;
#}
#
#role Role with Activity {
#	method config {
#		$self->config;
#	}
#}
#
#role Activity {
#	method config {
#		1;
#	}
#}
