App-Prima-REPL
view release on metacpan or search on metacpan
bin/prima-repl view on Meta::CPAN
use Carp;
use File::Spec;
use FindBin;
use PrimaX::InputHistory;
my $fileName = '.prima.repl.history';
my $historyLength = 200; # total number of lines to save to disk
#use Eval::WithLexicals;
my $DEBUG_OUTPUT = 0;
my $initrc_filename = 'prima-repl.initrc';
# Load PDL if they have it
my ($loaded_PDL, $loaded_Prima_Graphics);
BEGIN {
$loaded_PDL = 0;
eval {
require PDL;
PDL->import;
require PDL::NiceSlice;
$loaded_PDL = 1;
bin/prima-repl view on Meta::CPAN
# text items: working here
my $to_stderr = shift;
# Join the arguments and split them at the newlines and carriage returns:
my @args = map {defined $_ ? $_ : ''} ('', @_);
my @lines = split /([\n\r])/, join('', @args);
# Remove useless parts of error messages (which refer to lines in this code)
s/ \(eval \d+\)// for @lines;
# Open the logfile, which I'll print to simultaneously:
open my $logfile, '>>', 'prima-repl.logfile';
IO::OutWindow::print_to_terminal(@lines) if $DEBUG_OUTPUT or $to_stderr;
# Go through each line and carriage return, overwriting where appropriate:
foreach(@lines) {
# If it's a carriage return, set the current column to zero:
if (/\r/) {
$output_column = 0;
print $logfile "\\r\n";
}
# If it's a newline, increment the output line and set the column to
# zero:
elsif (/\n/) {
( run in 0.300 second using v1.01-cache-2.11-cpan-4e96b696675 )