/usr/lib/perl5/PDL/Doc/scantree.pl 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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | use PDL::Doc;
use Getopt::Std;
use Config;
use Cwd;
require PDL; # always needed to pick up PDL::VERSION
$opt_v = 0;
getopts('v');
$dirarg = shift @ARGV;
$outdb = shift @ARGV;
$outindex = shift @ARGV;
unless (defined $dirarg) {
($dirarg = $INC{'PDL.pm'}) =~ s/PDL\.pm$//i;
umask 0022;
print "DIR = $dirarg\n";
}
my @dirs = split /,/,$dirarg;
unless (defined $outdb) {
$outdb = "$dirs[0]/PDL/pdldoc.db";
print "DB = $outdb\n";
}
$currdir = getcwd;
unlink $outdb if -e $outdb;
$onldc = new PDL::Doc();
$onldc->outfile($outdb);
foreach $dir (@dirs) {
chdir $dir or die "can't change to $dir";
$dir = getcwd;
$onldc->scantree($dir."/PDL",$opt_v);
$onldc->scan($dir."/PDL.pm",$opt_v) if (-s $dir."/PDL.pm");
chdir $currdir;
}
print STDERR "saving...\n";
$onldc->savedb();
@mods = $onldc->search('module:',['Ref'],1);
@mans = $onldc->search('manual:',['Ref'],1);
@scripts = $onldc->search('script:',['Ref'],1);
$outdir = "$dirs[0]/PDL";
# ($outdir = $INC{'PDL.pm'}) =~ s/\.pm$//i;
$outindex="$outdir/Index.pod" unless (defined $outindex);
unlink $outindex if -e $outindex; # Handle read only file
open POD, ">$outindex"
or die "couldn't open $outindex";
print POD <<'EOPOD';
=head1 NAME
PDL::Index - an index of PDL documentation
=head1 DESCRIPTION
A meta document listing the documented PDL modules and
the PDL manual documents
=head1 PDL manuals
EOPOD
#print POD "=over ",$#mans+1,"\n\n";
print POD "=over 4\n\n";
for (@mans) {
my $ref = $_->[1]->{Ref};
$ref =~ s/Manual:/L<$_->[0]|$_->[0]> -/;
## print POD "=item L<$_->[0]>\n\n$ref\n\n";
# print POD "=item $_->[0]\n\n$ref\n\n";
print POD "=item *\n\n$ref\n\n";
}
print POD << 'EOPOD';
=back
=head1 PDL scripts
EOPOD
#print POD "=over ",$#mods+1,"\n\n";
print POD "=over 4\n\n";
for (@scripts) {
my $ref = $_->[1]->{Ref};
$ref =~ s/Script:/L<$_->[0]|PDL::$_->[0]> -/;
## print POD "=item L<$_->[0]>\n\n$ref\n\n";
# print POD "=item $_->[0]\n\n$ref\n\n";
print POD "=item *\n\n$ref\n\n";
}
print POD << 'EOPOD';
=back
=head1 PDL modules
EOPOD
#print POD "=over ",$#mods+1,"\n\n";
print POD "=over 4\n\n";
for (@mods) {
my $ref = $_->[1]->{Ref};
next unless $_->[0] =~ /^PDL/;
if( $_->[0] eq 'PDL'){ # special case needed to find the main PDL.pm file.
$ref =~ s/Module:/L<PDL::PDL|PDL::PDL> -/;
## print POD "=item L<PDL::PDL>\n\n$ref\n\n";
# print POD "=item PDL::PDL\n\n$ref\n\n";
print POD "=item *\n\n$ref\n\n";
next;
}
$ref =~ s/Module:/L<$_->[0]|$_->[0]> -/;
## print POD "=item L<$_->[0]>\n\n$ref\n\n";
# print POD "=item $_->[0]\n\n$ref\n\n";
print POD "=item *\n\n$ref\n\n";
}
print POD << "EOPOD";
=back
=head1 HISTORY
Automatically generated by scantree.pl for PDL version $PDL::VERSION.
EOPOD
close POD;
|