Skip Menu |

This queue is for tickets about the Devel-REPL CPAN distribution.

Report information
The Basics
Id: 91876
Status: new
Priority: 0/
Queue: Devel-REPL

People
Owner: Nobody in particular
Requestors: gortan [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: Enhancement: Support -I flag
I often miss the "-I" command line parameter in re.pl to add directories to @INC (so that it behaves similar to perl). The attached patch adds a "incdir" attribute to Devel::REPL::Script which adds the "-I" functionality. I didn't add anything to the documentation as it's pretty self-explaining IMHO. Please review!
Subject: add_inc.patch
628d0340062fb6fc29134be114390bbdd50ef903 diff --git a/lib/Devel/REPL/Script.pm b/lib/Devel/REPL/Script.pm index fb1e953..d3e6bf7 100644 --- a/lib/Devel/REPL/Script.pm +++ b/lib/Devel/REPL/Script.pm @@ -22,6 +22,14 @@ has 'profile' => ( default => sub { $ENV{DEVEL_REPL_PROFILE} || 'Minimal' }, ); +has 'incdir' => ( + is => 'ro', + isa => 'ArrayRef[Str]', + traits => ['MooseX::Getopt::Meta::Attribute::Trait'], + default => sub { [] }, + cmd_flag => 'I' +); + has '_repl' => ( is => 'ro', isa => 'Devel::REPL', default => sub { Devel::REPL->new() } @@ -31,6 +39,7 @@ sub BUILD { my ($self) = @_; $self->load_profile($self->profile); $self->load_rcfile($self->rcfile); + $self->add_inc(); } sub load_profile { @@ -53,6 +62,12 @@ sub load_rcfile { $self->apply_script($rc_file); } +sub add_inc { + my $self = shift; + unshift @INC, @{$self->incdir}; + return; +} + sub apply_script { my ($self, $script, $warn_on_unreadable) = @_;