PDLA-Core
view release on metacpan or search on metacpan
Doc/Doc/Perldl.pm view on Meta::CPAN
my $y;
local $PDLA::debug = 1;
$y = ( (UNIVERSAL::isa($x,'PDLA') && $x->nelem < 5 && $x->ndims < 2)
?
": $x" :
": *****"
);
$x->px($prefix.(ref $x)." %7T (%D) ".$y);
} else {
print "${prefix}Object: ".ref($x)."\n";
}
}
=head2 help
=for ref
print documentation about a PDLA function or module or show a PDLA manual
In the case of multiple matches, the first command found is printed out,
and the remaining commands listed, along with the names of their modules.
=for usage
Usage: help 'func'
=for example
pdla> help 'PDLA::Tutorials' # show the guide to PDLA tutorials
pdla> help 'PDLA::Slices' # show the docs in the PDLA::Slices module
pdla> help 'slice' # show docs on the 'slice' function
=cut
sub help_url {
local $_;
foreach(@INC) {
my $x = "$_/PDLA/HtmlDocs/PDLA/Index.html";
if(-e $x) {
return "file://$x";
}
}
}
sub help {
if ($#_>-1) {
require PDLA::Dbg;
my $topic = shift;
if (PDLA::Core::blessed($topic) && $topic->can('px')) {
local $PDLA::debug = 1;
$topic->px('This variable is');
} else {
$topic = 'PDLA::Doc::Perldl' if $topic =~ /^\s*help\s*$/i;
if ($topic =~ /^\s*vars\s*$/i) {
PDLA->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 {
finddoc($topic);
}
}
} else {
print <<'EOH';
The following commands support online help in the perldla shell:
help 'thing' -- print docs on 'thing' (func, module, manual, autoload-file)
help vars -- print information about all current piddles
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 piddle.
apropos 'word' -- search for keywords/function names
usage -- print usage information for a given PDLA function
sig -- print signature of PDLA function
('?' is an alias for 'help'; '??' is an alias for 'apropos'.)
EOH
print " badinfo -- information on the support for bad values\n"
if $bvalflag;
print <<'EOH';
Quick start:
apropos 'manual:' -- Find all the manual documents
apropos 'module:' -- Quick summary of all PDLA modules
help 'help' -- details about PDLA help system
help 'perldla' -- help about this shell
EOH
}
}
=head2 badinfo
( run in 1.573 second using v1.01-cache-2.11-cpan-140bd7fdf52 )