X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FScript.pm;h=fb1e9537a4b3a5ff4834c1a0abc58e9248662ab0;hp=aab0cc2f9da7ef43c9e6c6986ea31df523c1e7a4;hb=584978c990ea260400f416af78fe316f5fa7f0d2;hpb=cb3b891f24d8cf8b0b669bcb9cbb1135df12dace diff --git a/lib/Devel/REPL/Script.pm b/lib/Devel/REPL/Script.pm index aab0cc2..fb1e953 100644 --- a/lib/Devel/REPL/Script.pm +++ b/lib/Devel/REPL/Script.pm @@ -4,21 +4,26 @@ use Moose; use Devel::REPL; use File::HomeDir; use File::Spec; -use vars qw($CURRENT_SCRIPT); -use namespace::clean -except => [ qw(meta) ]; +use Module::Runtime 'use_module'; +use namespace::autoclean; + +our $CURRENT_SCRIPT; with 'MooseX::Getopt'; has 'rcfile' => ( - is => 'ro', isa => 'Str', required => 1, default => sub { 'repl.rc' }, + is => 'ro', isa => 'Str', + default => sub { 'repl.rc' }, ); has 'profile' => ( - is => 'ro', isa => 'Str', required => 1, default => sub { 'Default' }, + is => 'ro', + isa => 'Str', + default => sub { $ENV{DEVEL_REPL_PROFILE} || 'Minimal' }, ); has '_repl' => ( - is => 'ro', isa => 'Devel::REPL', required => 1, + is => 'ro', isa => 'Devel::REPL', default => sub { Devel::REPL->new() } ); @@ -31,7 +36,7 @@ sub BUILD { sub load_profile { my ($self, $profile) = @_; $profile = "Devel::REPL::Profile::${profile}" unless $profile =~ /::/; - Class::MOP::load_class($profile); + use_module $profile; confess "Profile class ${profile} doesn't do 'Devel::REPL::Profile'" unless $profile->does('Devel::REPL::Profile'); $profile->new->apply_profile($self->_repl);