From: Karen Etheridge Date: Sun, 19 May 2013 15:56:20 +0000 (-0700) Subject: remove pointless "required" fields for attrs with defaults/builders X-Git-Tag: v1.003018~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b595a818b1d89dbea55ace1af86d0df91c97ba0c;p=p5sagit%2FDevel-REPL.git remove pointless "required" fields for attrs with defaults/builders --- diff --git a/lib/Devel/REPL.pm b/lib/Devel/REPL.pm index 756c95a..c174bbd 100644 --- a/lib/Devel/REPL.pm +++ b/lib/Devel/REPL.pm @@ -12,22 +12,23 @@ with 'MooseX::Object::Pluggable'; use Devel::REPL::Error; has 'term' => ( - is => 'rw', required => 1, + is => 'rw', default => sub { Term::ReadLine->new('Perl REPL') } ); has 'prompt' => ( - is => 'rw', required => 1, + is => 'rw', default => sub { '$ ' } ); has 'out_fh' => ( - is => 'rw', required => 1, lazy => 1, + is => 'rw', + lazy => 1, default => sub { shift->term->OUT || \*STDOUT; } ); has 'exit_repl' => ( - is => 'rw', required => 1, + is => 'rw', default => sub { 0 } ); diff --git a/lib/Devel/REPL/Plugin/Commands.pm b/lib/Devel/REPL/Plugin/Commands.pm index 04aa22e..6f03b62 100644 --- a/lib/Devel/REPL/Plugin/Commands.pm +++ b/lib/Devel/REPL/Plugin/Commands.pm @@ -7,7 +7,7 @@ use namespace::autoclean; use vars qw($COMMAND_INSTALLER); has 'command_set' => ( - is => 'ro', required => 1, + is => 'ro', lazy => 1, default => sub { {} } ); diff --git a/lib/Devel/REPL/Plugin/History.pm b/lib/Devel/REPL/Plugin/History.pm index 8d77d05..2696e19 100644 --- a/lib/Devel/REPL/Plugin/History.pm +++ b/lib/Devel/REPL/Plugin/History.pm @@ -4,13 +4,15 @@ use Devel::REPL::Plugin; use namespace::autoclean; has 'history' => ( - isa => 'ArrayRef', is => 'rw', required => 1, lazy => 1, + isa => 'ArrayRef', is => 'rw', + lazy => 1, default => sub { [] } ); # lazy so ReadLineHistory Plugin can set this has 'have_readline_history' => ( - is => 'rw', required => 1, lazy => 1, + is => 'rw', + lazy => 1, default => sub { 0 } ); diff --git a/lib/Devel/REPL/Plugin/LexEnv.pm b/lib/Devel/REPL/Plugin/LexEnv.pm index e9a297f..f487fa2 100644 --- a/lib/Devel/REPL/Plugin/LexEnv.pm +++ b/lib/Devel/REPL/Plugin/LexEnv.pm @@ -12,7 +12,6 @@ sub BEFORE_PLUGIN { has 'lexical_environment' => ( isa => 'Lexical::Persistence', is => 'rw', - required => 1, lazy => 1, default => sub { Lexical::Persistence->new } ); diff --git a/lib/Devel/REPL/Plugin/MultiLine/PPI.pm b/lib/Devel/REPL/Plugin/MultiLine/PPI.pm index e9a2c2d..ca85806 100644 --- a/lib/Devel/REPL/Plugin/MultiLine/PPI.pm +++ b/lib/Devel/REPL/Plugin/MultiLine/PPI.pm @@ -5,12 +5,14 @@ use PPI; use namespace::autoclean; has 'continuation_prompt' => ( - is => 'rw', required => 1, lazy => 1, + is => 'rw', + lazy => 1, default => sub { '> ' } ); has 'line_depth' => ( - is => 'rw', required => 1, lazy => 1, + is => 'rw', + lazy => 1, default => sub { 0 } ); diff --git a/lib/Devel/REPL/Script.pm b/lib/Devel/REPL/Script.pm index fec8e7d..c748b95 100644 --- a/lib/Devel/REPL/Script.pm +++ b/lib/Devel/REPL/Script.pm @@ -10,18 +10,18 @@ use namespace::autoclean; 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 { $ENV{DEVEL_REPL_PROFILE} || 'Default' }, ); has '_repl' => ( - is => 'ro', isa => 'Devel::REPL', required => 1, + is => 'ro', isa => 'Devel::REPL', default => sub { Devel::REPL->new() } );