"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Demos/Demos.pm" between
PDL-2.077.tar.gz and PDL-2.078.tar.gz

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

Demos.pm  (PDL-2.077):Demos.pm  (PDL-2.078)
skipping to change at line 12 skipping to change at line 12
use strict; use strict;
use warnings; use warnings;
use Carp; use Carp;
use Exporter; use Exporter;
require File::Spec; require File::Spec;
our @ISA="Exporter"; our @ISA="Exporter";
our @EXPORT = qw/comment act actnw output/; our @EXPORT = qw/comment act actnw output/;
sub home() {
if (-e '/usr/bin/tput') {
system 'tput clear';
} elsif ( $^O eq 'MSWin32' ) {
system 'cls';
}
}
sub comment($) { sub comment($) {
local $SIG{__DIE__} = \&Carp::confess; local $SIG{__DIE__} = \&Carp::confess;
home();
print "----\n"; print "----\n";
print $_[0]; print $_[0];
my $prompt = "---- (press enter)"; my $prompt = "---- (press enter)";
defined($PERLDL::TERM) ? $PERLDL::TERM->readline($prompt) : ( print $prompt, <> ); defined($PERLDL::TERM) ? $PERLDL::TERM->readline($prompt) : ( print $prompt, <> );
} }
sub act($) { sub act($) {
local $SIG{__DIE__} = \&Carp::confess; local $SIG{__DIE__} = \&Carp::confess;
actnw($_[0], (caller)[0]); actnw($_[0], (caller)[0]);
my $prompt = "---- (press enter)"; my $prompt = "---- (press enter)";
defined($PERLDL::TERM) ? $PERLDL::TERM->readline($prompt) : ( print $prompt, <> ); defined($PERLDL::TERM) ? $PERLDL::TERM->readline($prompt) : ( print $prompt, <> );
} }
sub _eval_pkg { sub _eval_pkg {
my ($txt, $pack) = @_; my ($txt, $pack) = @_;
eval "package $pack; no strict; use PDL; $txt"; eval "package $pack; no strict; use PDL; $txt";
} }
sub actnw($) { sub actnw($) {
local $SIG{__DIE__} = \&Carp::confess; local $SIG{__DIE__} = \&Carp::confess;
home();
my ($script, $pack) = @_; my ($script, $pack) = @_;
$script =~ s/^(\s*)output/$1print/mg; $script =~ s/^(\s*)output/$1print/mg;
print "---- Code:"; print "---- Code:";
print $script; print $script;
print "---- Output:\n"; print "---- Output:\n";
_eval_pkg($script, $pack // (caller)[0]); _eval_pkg($script, $pack // (caller)[0]);
print "----\n"; print "----\n";
print "----\nOOPS!!! Something went wrong, please make a bug report!: $@\n--- -\n" if $@; print "----\nOOPS!!! Something went wrong, please make a bug report!: $@\n--- -\n" if $@;
} }
 End of changes. 3 change blocks. 
10 lines changed or deleted 0 lines changed or added

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