PDL
view release on metacpan or search on metacpan
lib/PDL/Demos.pm view on Meta::CPAN
sub comment($) {
local $SIG{__DIE__} = \&Carp::confess;
print "----\n";
print $_[0];
my $prompt = "---- (press enter)";
defined($PERLDL::TERM) ? $PERLDL::TERM->readline($prompt) : ( print $prompt, <> );
}
sub act($) {
local $SIG{__DIE__} = \&Carp::confess;
actnw($_[0], (caller)[0]);
my $prompt = "---- (press enter)";
defined($PERLDL::TERM) ? $PERLDL::TERM->readline($prompt) : ( print $prompt, <> );
}
sub _eval_pkg {
my ($txt, $pack) = @_;
eval "package $pack; no strict; use PDL; $txt";
}
sub actnw($) {
local $SIG{__DIE__} = \&Carp::confess;
my ($script, $pack) = @_;
print "---- Code:";
print $script;
print "---- Output:\n";
_eval_pkg($script, $pack // (caller)[0]);
print "----\n";
print "----\nOOPS!!! Something went wrong, please make a bug report!: $@\n----\n" if $@;
}
my ($searched, @found);
my @d = qw(PDL Demos);
sub list {
return @found if $searched;
$searched = 1;
my %found_already;
lib/PDL/Doc/Perldl.pm view on Meta::CPAN
sub help {
if (@_) {
require PDL::Dbg;
my $topic = shift;
if (PDL::Core::blessed($topic) && $topic->can('px')) {
local $PDL::debug = 1;
$topic->px('This variable is');
} else {
$topic = 'PDL::Doc::Perldl' if $topic =~ /^\s*help\s*$/i;
if ($topic =~ /^\s*vars\s*$/i) {
PDL->px((caller)[0]);
} else {
finddoc($topic);
}
}
} else {
print <<'EOH';
The following commands support online help in the perldl shell:
help 'thing' -- print docs on 'thing' (func, module, manual, autoload-file)
lib/PDL/NiceSlice/FilterUtilCall.pm view on Meta::CPAN
$_ = findslice $_ unless $status < 0; # the actual filter
$_ .= "no $class;\n" if $off;
$_ .= "$end\n" if $end;
return $count;
};
}
}
sub import {
my ($class) = @_;
my ($file,$offset) = (caller)[1,2]; # for error reporting
## Parse class name into a regexp suitable for filtration
filter_add(PDL::NiceSlice::FilterUtilCall::make_filter($class, $file, $offset+1));
}
sub unimport {
filter_del();
}
1;
lib/PDL/PP.pm view on Meta::CPAN
@_,
"\nMODULE = $::PDLMOD PACKAGE = $::PDLOBJ PREFIX=pdl_run_\n\n");
}
# inserts #line directives into source text. Use like this:
# ...
# FirstKey => ...,
# Code => pp_line_numbers(__LINE__, $x . $y . $c),
# OtherKey => ...
sub pp_line_numbers {
_pp_line_number_file((caller)[1], @_);
}
sub _pp_line_number_file {
my ($filename, $line, $string) = @_;
confess "pp_line_numbers called with undef" if !defined $string;
# The line needs to be incremented by one for the bookkeeping to work
$line++;
$filename = 'lib/PDL/PP.pm' if $filename eq __FILE__;
$filename =~ s/\\/\\\\/g; # Escape backslashes
my @to_return = "\nPDL_LINENO_START $line \"$filename\"\n";
# Look for broadcastloops and loops and add # line directives
( run in 0.775 second using v1.01-cache-2.11-cpan-a3c8064c92c )