diff --git a/tools/iperl b/tools/iperl index 016bc51..b72ba64 100755 --- a/tools/iperl +++ b/tools/iperl @@ -30,8 +30,10 @@ sub usage { usage: $prog [options] -h,--help show this message -e,--eval STR eval STR before interaction - -p,--pipe run in pipe mode (as a subprocess) + -p,--pipe run in pipe mode + -q,--quiet hide undef eval output -r,--run PATH run PATH before interaction + -v,--verbose output all eval results (default) perl needs a good interpreter. EOT @@ -243,6 +245,7 @@ sub main { my ($prompt1, $prompt2) = ("\001\033[24m\002>>>", "\001\033[24m\002..>"); # process the arguments provided; save original @ARGV for use later + my $quiet; my @preload; my @oldargv = @ARGV; Getopt::Long::GetOptions( @@ -251,6 +254,8 @@ sub main { 'pipe|p' => sub { $pipe = 'line' }, 'run|r=s' => sub { push(@preload, ['run', $_[1]]); }, 'use|u=s' => sub { push(@preload, ['use', $_[1]]); }, + 'quiet|q' => sub { $quiet = 1; }, + 'verbose|v' => sub { $quiet = undef; }, ) || usage(1); # let's display a nice banner to the user @@ -355,7 +360,9 @@ sub main { print $@; } elsif(scalar(@results) == 0) { } elsif(scalar(@results) == 1) { - print $results[0] . "\n" unless $results[0] eq 'undef'; + if(!$quiet || $results[0] ne 'undef') { + print $results[0] . "\n"; + } } else { print join(", ", @results) . "\n"; }