"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Doc/Doc/Perldl.pm" between
PDL-2.082.tar.gz and PDL-2.083.tar.gz

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

Perldl.pm  (PDL-2.082):Perldl.pm  (PDL-2.083)
skipping to change at line 53 skipping to change at line 53
use strict; use strict;
use warnings; use warnings;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( apropos aproposover usage help sig badinfo whatis ); our @EXPORT = qw( apropos aproposover usage help sig badinfo whatis );
use PDL::Doc; use PDL::Doc;
use Pod::Select; use Pod::Select;
use Pod::PlainText; use Pod::PlainText;
use Term::ReadKey; #for GetTerminalSize use Term::ReadKey; #for GetTerminalSize
use Cwd; # to help Debian packaging
$PDL::onlinedoc = undef;
$PDL::onlinedoc = PDL::Doc->new(FindStdFile()); $PDL::onlinedoc = PDL::Doc->new(FindStdFile());
# Find std file # Find std file
sub FindStdFile { sub FindStdFile {
my ($d,$f); my ($f) = PDL::Doc::_find_inc([qw(PDL pdldoc.db)], 0);
for $d (@INC) { warn("Unable to find PDL/pdldoc.db in ".join(":",@INC)."\n"), return if !defin
$f = $d."/PDL/pdldoc.db"; ed $f;
if (-f $f) { print "Found docs database $f\n" if $PDL::verbose;
print "Found docs database $f\n" if $PDL::verbose; print "Type 'help' for online help\n" if $PDL::verbose;
print "Type 'help' for online help\n" if $PDL::verbose; return $f;
return $f;
}
}
warn "Unable to find PDL/pdldoc.db in ".join(":",@INC)."\n";
} }
# used to find out how wide the screen should be # used to find out how wide the screen should be
# for printmatch() - really should check for a # for printmatch() - really should check for a
# sensible lower limit (for printmatch >~ 40 # sensible lower limit (for printmatch >~ 40
# would be my guess) # would be my guess)
# #
# taken from Pod::Text (v1.0203), then hacked to get it # taken from Pod::Text (v1.0203), then hacked to get it
# to work (at least on my solaris and linux # to work (at least on my solaris and linux
# machines) # machines)
skipping to change at line 120 skipping to change at line 115
sub format_ref { sub format_ref {
my @match = @_; my @match = @_;
my @text = (); my @text = ();
#finding the max width before doing the printing means looping through @match an extra time; so be it. #finding the max width before doing the printing means looping through @match an extra time; so be it.
my @module_shorthands = map { shortmod($_->[1]) } @match; my @module_shorthands = map { shortmod($_->[1]) } @match;
my $max_mod_length = -1; my $max_mod_length = -1;
map {$max_mod_length = length if (length>$max_mod_length) } @module_shorthands ; map {$max_mod_length = length if (length>$max_mod_length) } @module_shorthands ;
my $width = screen_width()-17-1-$max_mod_length; my $width = screen_width()-17-1-$max_mod_length;
my $parser = new Pod::PlainText( width => $width, indent => 0, sentence => 0 ) ; my $parser = Pod::PlainText->new( width => $width, indent => 0, sentence => 0 );
for my $m (@match) { for my $m (@match) {
my $ref = $m->[2]{Ref} || my $ref = $m->[2]{Ref} ||
( (defined $m->[2]{CustomFile}) ( (defined $m->[2]{CustomFile})
? "[No ref avail. for `".$m->[2]{CustomFile}."']" ? "[No ref avail. for `".$m->[2]{CustomFile}."']"
: "[No reference available]" : "[No reference available]"
); );
my $name = $m->[0]; my $name = $m->[0];
my $module = shortmod($m->[1]); my $module = shortmod($m->[1]);
skipping to change at line 292 skipping to change at line 287
} }
my $m = shift @match; my $m = shift @match;
my $Ref = $m->[2]{Ref}; my $Ref = $m->[2]{Ref};
if ( $Ref && $Ref =~ /^(Module|Manual|Script): / ) { if ( $Ref && $Ref =~ /^(Module|Manual|Script): / ) {
# We've got a file name and we have to open it. With the relocatable db, we have to reconstitute the absolute pathname. # We've got a file name and we have to open it. With the relocatable db, we have to reconstitute the absolute pathname.
my $relfile = $m->[2]{File}; my $relfile = $m->[2]{File};
my $absfile = undef; my $absfile = undef;
my @scnd = @{$PDL::onlinedoc->{Scanned}}; my @scnd = @{$PDL::onlinedoc->{Scanned}};
for my $dbf(@scnd){ for my $dbf (@scnd) {
$dbf = Cwd::abs_path($dbf); # help Debian packaging
$dbf =~ s:\/[^\/]*$::; # Trim file name off the end of the databas e file to get just the directory $dbf =~ s:\/[^\/]*$::; # Trim file name off the end of the databas e file to get just the directory
$dbf .= "/$relfile"; $dbf .= "/$relfile";
$absfile = $dbf if( -e $dbf ); $absfile = $dbf if( -e $dbf );
} }
unless ($absfile) { unless ($absfile) {
die "Documentation error: couldn't find absolute path to $relfile\ n"; die "Documentation error: couldn't find absolute path to $relfile\ n";
} }
open my $in, "<", $absfile; open my $in, "<", $absfile;
print $out join("",<$in>); print $out join("",<$in>);
} else { } else {
skipping to change at line 614 skipping to change at line 610
Usage: help 'func' Usage: help 'func'
=for example =for example
pdl> help 'PDL::Tutorials' # show the guide to PDL tutorials pdl> help 'PDL::Tutorials' # show the guide to PDL tutorials
pdl> help 'PDL::Slices' # show the docs in the PDL::Slices module pdl> help 'PDL::Slices' # show the docs in the PDL::Slices module
pdl> help 'slice' # show docs on the 'slice' function pdl> help 'slice' # show docs on the 'slice' function
=cut =cut
sub help_url {
local $_;
foreach(@INC) {
my $x = "$_/PDL/HtmlDocs/PDL/Index.html";
if(-e $x) {
return "file://$x";
}
}
}
sub help { sub help {
if ($#_>-1) { if ($#_>-1) {
require PDL::Dbg; require PDL::Dbg;
my $topic = shift; my $topic = shift;
if (PDL::Core::blessed($topic) && $topic->can('px')) { if (PDL::Core::blessed($topic) && $topic->can('px')) {
local $PDL::debug = 1; local $PDL::debug = 1;
$topic->px('This variable is'); $topic->px('This variable is');
} else { } else {
$topic = 'PDL::Doc::Perldl' if $topic =~ /^\s*help\s*$/i; $topic = 'PDL::Doc::Perldl' if $topic =~ /^\s*help\s*$/i;
if ($topic =~ /^\s*vars\s*$/i) { if ($topic =~ /^\s*vars\s*$/i) {
PDL->px((caller)[0]); PDL->px((caller)[0]);
} elsif($topic =~ /^\s*url\s*/i) {
my $x = help_url();
if($x) {
print $x;
} else {
print "Hmmm. Curious: I couldn't find the HTML docs anywhere in
\@INC...\n";
}
} elsif($topic =~ /^\s*www(:([^\s]+))?\s*/i) {
my $browser;
my $url = help_url();
if($2) {
$browser = $2;
} elsif($ENV{PERLDL_WWW}) {
$browser = $ENV{PERLDL_WWW};
} else {
$browser = 'mozilla';
}
chomp($browser = `which $browser`);
if(-e $browser && -x $browser) {
print "Spawning \"$browser $url\"...\n";
`$browser $url`;
}
} else { } else {
finddoc($topic); finddoc($topic);
} }
} }
} else { } else {
print <<'EOH'; print <<'EOH';
The following commands support online help in the perldl shell: The following commands support online help in the perldl shell:
help 'thing' -- print docs on 'thing' (func, module, manual, autoload-file) help 'thing' -- print docs on 'thing' (func, module, manual, autoload-file)
help vars -- print information about all current ndarrays help vars -- print information about all current ndarrays
help url -- locate the HTML version of the documentation
help www -- View docs with default web browser (set by env: PERLDL_WWW)
whatis <expr> -- Describe the type and structure of an expression or ndarray. whatis <expr> -- Describe the type and structure of an expression or ndarray.
apropos 'word' -- search for keywords/function names apropos 'word' -- search for keywords/function names
usage -- print usage information for a given PDL function usage -- print usage information for a given PDL function
sig -- print signature of PDL function sig -- print signature of PDL function
badinfo -- information on the support for bad values badinfo -- information on the support for bad values
('?' is an alias for 'help'; '??' is an alias for 'apropos'.) ('?' is an alias for 'help'; '??' is an alias for 'apropos'.)
Quick start: Quick start:
 End of changes. 8 change blocks. 
48 lines changed or deleted 10 lines changed or added

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