"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Perldl2/Profile/Perldl2.pm" between
PDL-2.076.tar.gz and PDL-2.077.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

Perldl2.pm  (PDL-2.076):Perldl2.pm  (PDL-2.077)
skipping to change at line 13 skipping to change at line 13
use strict; use strict;
use warnings; use warnings;
use Moose; use Moose;
use namespace::clean -except => [ 'meta' ]; use namespace::clean -except => [ 'meta' ];
our $VERSION = 0.008; our $VERSION = 0.008;
$PERLDL::PROMPT = $PERLDL::PROMPT; # suppress warning $PERLDL::PROMPT = $PERLDL::PROMPT; # suppress warning
with 'Devel::REPL::Profile'; with 'Devel::REPL::Profile';
my %plugin2deps = (
'Completion' => [qw(PPI)],
'CompletionDriver::INC' => [qw(File::Next)],
'CompletionDriver::Keywords' => [qw(B::Keywords)],
'CompletionDriver::LexEnv' => [qw(Lexical::Persistence)],
'DDS' => [qw(Data::Dump::Streamer)],
'Interrupt' => [qw(Sys::SigAction)],
'LexEnv' => [qw(Lexical::Persistence)],
'MultiLine::PPI' => [qw(PPI)],
);
sub plugins { sub plugins {
qw( qw(
CleanErrors CleanErrors
Commands Commands
Completion Completion
CompletionDriver::INC CompletionDriver::INC
CompletionDriver::Keywords CompletionDriver::Keywords
CompletionDriver::LexEnv CompletionDriver::LexEnv
CompletionDriver::Methods CompletionDriver::Methods
DDS DDS
History History
Interrupt
LexEnv LexEnv
MultiLine::PPI MultiLine::PPI
Packages Packages
NiceSlice NiceSlice
PrintControl PrintControl
ReadLineHistory ReadLineHistory
PDLCommands PDLCommands
); # CompletionDriver::Globals ); # CompletionDriver::Globals
} }
skipping to change at line 50 skipping to change at line 61
$repl->print(" Please install either Term::ReadLine::Perl or Term::ReadLin e::Gnu.\n"); $repl->print(" Please install either Term::ReadLine::Perl or Term::ReadLin e::Gnu.\n");
$repl->print(" Falling back to perldl in the meantime...\n"); $repl->print(" Falling back to perldl in the meantime...\n");
$repl->print("------------------------------------------\n\n"); $repl->print("------------------------------------------\n\n");
exec 'perldl'; exec 'perldl';
} }
# add PDL::Perldl2 for plugin search # add PDL::Perldl2 for plugin search
push @{$repl->_plugin_app_ns}, 'PDL::Perldl2'; push @{$repl->_plugin_app_ns}, 'PDL::Perldl2';
foreach my $plug ($self->plugins) { foreach my $plug ($self->plugins) {
if ($plug =~ 'CompletionDriver::INC') { if (my $deps = $plugin2deps{$plug}) {
eval 'use File::Next'; next if grep !eval "require $_; 1", @$deps;
next if $@; }
} $repl->load_plugin($plug);
if ($plug =~ 'CompletionDriver::Keywords') {
eval 'use B::Keywords';
next if $@;
}
$repl->load_plugin($plug);
}
# these plugins don't work on win32
unless ($^O =~ m/win32/i) {
$repl->load_plugin('Interrupt');
} }
# enable Term::ReadLine file expansion by default # enable Term::ReadLine file expansion by default
$repl->do_readline_filename_completion(1) if $repl->can('do_readline_filename _completion'); $repl->do_readline_filename_completion(1) if $repl->can('do_readline_filename _completion');
# do perldl stuff here # do perldl stuff here
$repl->eval('package main'); $repl->eval('package main');
$repl->eval('use PDL'); $repl->eval('use PDL');
$repl->eval('use PDL::Config'); $repl->eval('use PDL::Config');
skipping to change at line 113 skipping to change at line 114
# list history command # list history command
$repl->eval('sub l { $repl->eval('sub l {
my $n = $#_ > -1 ? shift : 20; my $n = $#_ > -1 ? shift : 20;
my @h = $_REPL->term->GetHistory(); my @h = $_REPL->term->GetHistory();
my $min = $#h < $n-1 ? 0 : $#h-$n+1; my $min = $#h < $n-1 ? 0 : $#h-$n+1;
map { printf "%d: %s\n", $_+1, $h[$_] } ($min..$#h); map { printf "%d: %s\n", $_+1, $h[$_] } ($min..$#h);
#map {print "$_: $h[$_]\n"} ($min..$#h); #map {print "$_: $h[$_]\n"} ($min..$#h);
};'); };');
# preliminary support for PDL demos
$repl->eval( q{ $repl->eval( q{
sub demo { sub with_time (&) {
local $_ = lc $_[0] ; require Time::HiRes;
if(/^$/) { my @t = Time::HiRes::gettimeofday();
print <<EOD; &{$_[0]}();
Use: printf "%g ms\n", Time::HiRes::tv_interval(\@t) * 1000;
demo pdl # general demo }
} );
demo 3d # 3d demo (requires TriD with OpenGL or Mesa)
demo 3d2 # 3d demo, part 2. (Somewhat memory-intensive)
demo 3dgal # the 3D gallery: make cool images with 3-line scripts
demo pgplot # PGPLOT graphics output (Req.: PGPLOT)
demo OOplot # PGPLOT OO interface (Req.: PGPLOT)
demo gnuplot # Gnuplot graphics (requires PDL::Graphics::Gnuplot)
demo prima # Prima graphics (requires PDL::Graphics::Prima)
demo transform # Coordinate transformations (Req.: PGPLOT)
demo cartography # Cartographic projections (Req.: PGPLOT)
demo bad # Bad-value demo (Req.: bad value support)
demo bad2 # Bad-values, part 2 (Req.: bad value support and PGPLOT)
EOD
return;
} # if: /^$/
my %demos = (
'pdl' => 'PDL::Demos::General', # have to protect pdl as it means somet
hing
'3d' => 'PDL::Demos::TriD1',
'3d2' => 'PDL::Demos::TriD2',
'3dgal' => 'PDL::Demos::TriDGallery',
'pgplot' => 'PDL::Demos::PGPLOT_demo',
'ooplot' => 'PDL::Demos::PGPLOT_OO_demo', # note: lowercase
'bad' => 'PDL::Demos::BAD_demo',
'bad2' => 'PDL::Demos::BAD2_demo',
'transform' => 'PDL::Demos::Transform_demo',
'cartography' => 'PDL::Demos::Cartography_demo',
'gnuplot' => 'PDL::Demos::Gnuplot_demo',
'prima' => 'PDL::Demos::Prima',
);
if ( exists $demos{$_} ) {
require PDL::Demos::Screen; # Get the routines for screen demos.
my $name = $demos{$_};
eval "require $name;"; # see docs on require for need for eval
$name .= "::run";
no strict 'refs';
&{$name}();
} else {
print "No such demo!\n";
}
} } ); $repl->eval( q{
use PDL::Demos;
sub demo {
if (!$_[0]) {
require List::Util;
my @kw = sort grep $_ ne 'pdl', PDL::Demos->keywords;
my $maxlen = List::Util::max(map length, @kw);
print "Use:\n";
printf " demo %-${maxlen}s # %s\n", @$_[0,1] for map [PDL::Demos->info
($_)], 'pdl', @kw;
return;
}
no strict;
PDL::Demos->init($_[0]);
$_->[0]->($_->[1]) for PDL::Demos->demo($_[0]);
PDL::Demos->done($_[0]);
}
} );
if ($repl->can('do_print')) { if ($repl->can('do_print')) {
$repl->eval('sub do_print { $_REPL->do_print(@_) };'); $repl->eval('sub do_print { $_REPL->do_print(@_) };');
} }
if ($repl->can('exit_repl')) { if ($repl->can('exit_repl')) {
$repl->eval('sub quit { $_REPL->exit_repl(1) };'); $repl->eval('sub quit { $_REPL->exit_repl(1) };');
} else { } else {
$repl->eval('sub quit { $_REPL->print("Use Ctrl-D or exit to quit" };'); $repl->eval('sub quit { $_REPL->print("Use Ctrl-D or exit to quit" };');
} }
 End of changes. 6 change blocks. 
68 lines changed or deleted 40 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)