"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Doc/scantree.pl" 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).

scantree.pl  (PDL-2.082):scantree.pl  (PDL-2.083)
use strict;
use warnings;
use PDL::Doc; use PDL::Doc;
use Getopt::Std; use Getopt::Std;
use Config; use Config;
use Cwd; use Cwd;
require PDL; # always needed to pick up PDL::VERSION require PDL; # always needed to pick up PDL::VERSION
$opt_v = 0; our $opt_v = 0;
getopts('v'); getopts('v');
$dirarg = shift @ARGV; my $dirarg = shift @ARGV;
$outdb = shift @ARGV; my $outdb = shift @ARGV;
$outindex = shift @ARGV; my $outindex = shift @ARGV;
unless (defined $dirarg) { unless (defined $dirarg) {
($dirarg = $INC{'PDL.pm'}) =~ s/PDL\.pm$//i; ($dirarg = $INC{'PDL.pm'}) =~ s/PDL\.pm$//i;
umask 0022; umask 0022;
print "DIR = $dirarg\n"; print "DIR = $dirarg\n";
} }
my @dirs = split /,/,$dirarg; my @dirs = split /,/,$dirarg;
unless (defined $outdb) { unless (defined $outdb) {
$outdb = "$dirs[0]/PDL/pdldoc.db"; $outdb = "$dirs[0]/PDL/pdldoc.db";
print "DB = $outdb\n"; print "DB = $outdb\n";
} }
$currdir = getcwd;
unlink $outdb if -e $outdb; unlink $outdb if -e $outdb;
$onldc = new PDL::Doc(); my $onldc = PDL::Doc->new;
$onldc->outfile($outdb); $onldc->outfile($outdb);
foreach $dir (@dirs) { foreach my $dir (@dirs) {
chdir $dir or die "can't change to $dir";
$dir = getcwd;
$onldc->scantree($dir."/PDL",$opt_v); $onldc->scantree($dir."/PDL",$opt_v);
$onldc->scan($dir."/PDL.pm",$opt_v) if (-s $dir."/PDL.pm"); $onldc->scan($dir."/PDL.pm",$opt_v) if (-s $dir."/PDL.pm");
chdir $currdir;
} }
print STDERR "saving...\n"; print STDERR "saving...\n";
$onldc->savedb(); $onldc->savedb();
@mods = $onldc->search('module:',['Ref'],1); my @mods = $onldc->search('module:',['Ref'],1);
@mans = $onldc->search('manual:',['Ref'],1); my @mans = $onldc->search('manual:',['Ref'],1);
@scripts = $onldc->search('script:',['Ref'],1); my @scripts = $onldc->search('script:',['Ref'],1);
$outdir = "$dirs[0]/PDL"; my $outdir = "$dirs[0]/PDL";
# ($outdir = $INC{'PDL.pm'}) =~ s/\.pm$//i; # ($outdir = $INC{'PDL.pm'}) =~ s/\.pm$//i;
$outindex="$outdir/Index.pod" unless (defined $outindex); $outindex="$outdir/Index.pod" unless (defined $outindex);
unlink $outindex if -e $outindex; # Handle read only file unlink $outindex if -e $outindex; # Handle read only file
open my $podfh, ">", $outindex or die "couldn't open $outindex: $!"; open my $podfh, ">", $outindex or die "couldn't open $outindex: $!";
print $podfh <<'EOPOD'; print $podfh <<'EOPOD';
=head1 NAME =head1 NAME
PDL::Index - an index of PDL documentation PDL::Index - an index of PDL documentation
skipping to change at line 73 skipping to change at line 69
EOPOD EOPOD
print $podfh "=over 4\n\n"; print $podfh "=over 4\n\n";
for (@mans) { for (@mans) {
my $ref = $_->[2]->{Ref}; my $ref = $_->[2]->{Ref};
$ref =~ s/Manual:/L<$_->[0]> -/; $ref =~ s/Manual:/L<$_->[0]> -/;
print $podfh "=item *\n\n$ref\n\n"; print $podfh "=item *\n\n$ref\n\n";
} }
print $podfh << 'EOPOD'; print $podfh <<'EOPOD';
=back =back
=head1 PDL scripts =head1 PDL scripts
EOPOD EOPOD
print $podfh "=over 4\n\n"; print $podfh "=over 4\n\n";
for (@scripts) { for (@scripts) {
my $ref = $_->[2]->{Ref}; my $ref = $_->[2]->{Ref};
$ref =~ s/Script:/L<$_->[0]|PDL::$_->[0]> -/; $ref =~ s/Script:/L<$_->[0]|PDL::$_->[0]> -/;
print $podfh "=item *\n\n$ref\n\n"; print $podfh "=item *\n\n$ref\n\n";
} }
print $podfh << 'EOPOD'; print $podfh <<'EOPOD';
=back =back
=head1 PDL modules =head1 PDL modules
EOPOD EOPOD
print $podfh "=over 4\n\n"; print $podfh "=over 4\n\n";
for (@mods) { for (@mods) {
my $ref = $_->[2]->{Ref}; my $ref = $_->[2]->{Ref};
next unless $_->[0] =~ /^PDL/; next unless $_->[0] =~ /^PDL/;
if( $_->[0] eq 'PDL'){ # special case needed to find the main PDL.pm file. if( $_->[0] eq 'PDL'){ # special case needed to find the main PDL.pm file.
$ref =~ s/Module:/L<PDL> -/; $ref =~ s/Module:/L<PDL> -/;
print $podfh "=item *\n\n$ref\n\n"; print $podfh "=item *\n\n$ref\n\n";
next; next;
} }
$ref =~ s/Module:/L<$_->[0]> -/; $ref =~ s/Module:/L<$_->[0]> -/;
print $podfh "=item *\n\n$ref\n\n"; print $podfh "=item *\n\n$ref\n\n";
} }
print $podfh << "EOPOD"; print $podfh <<"EOPOD";
=back =back
=head1 HISTORY =head1 HISTORY
Automatically generated by scantree.pl for PDL version $PDL::VERSION. Automatically generated by scantree.pl for PDL version $PDL::VERSION.
EOPOD EOPOD
close $podfh; close $podfh;
 End of changes. 11 change blocks. 
19 lines changed or deleted 15 lines changed or added

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