/usr/lib/perl5/PDL/Demos/Screen.pm is in pdl 1:2.007-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # Perform pdl demos on terminals
package PDL::Demos::Routines;
# Copyright (C) 1998 Tuomas J. Lukka.
# All rights reserved, except redistribution
# with PDL under the PDL License permitted.
use Carp;
use PDL;
@ISA="Exporter";
@EXPORT = qw/comment act actnw output/;
$SIG{__DIE__} = sub {die Carp::longmess(@_);};
sub home() {
if (-e '/usr/bin/tput') {
system 'tput clear';
} elsif ( $^O eq 'MSWin32' ) {
system 'cls';
}
}
sub comment($) {
home();
print "----\n";
print $_[0];
my $prompt = "---- (press enter)";
defined($PERLDL::TERM) ? $PERLDL::TERM->readline($prompt) : ( print $prompt, <> );
}
sub act($) {
home();
my $script = $_[0];
$script =~ s/^(\s*)output/$1print/mg;
print "---- Code:";
print $script;
print "---- Output:\n";
my $pack = (caller)[0];
# eval "package $pack; use PDL; $_[0]";
eval "package $pack; use PDL; $_[0]";
print "----\nOOPS!!! Something went wrong, please make a bug report!: $@\n----\n" if $@;
my $prompt = "---- (press enter)";
defined($PERLDL::TERM) ? $PERLDL::TERM->readline($prompt) : ( print $prompt, <> );
}
sub actnw($) {
home();
my $script = $_[0];
$script =~ s/^(\s*)output/$1print/mg;
print "---- Code:";
print $script;
print "---- Output:\n";
my $pack = (caller)[0];
# eval "package $pack; use PDL; $_[0]";
eval "package $pack; use PDL; $_[0]";
print "----\n";
print "----\nOOPS!!! Something went wrong, please make a bug report!: $@\n----\n" if $@;
}
sub output {print @_}
|