Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 38 lines (32 sloc) 0.676 kB
#!/usr/bin/perl
my %seen;
while (<>) {
if (/^%\s*(include|require)\s+\"([^\"]+)\"/) {
include($2, ($1 eq "require"));
next;
}
print;
}
sub include
{
my($file, $require, $level) = @_;
$level ||= 0;
return if $seen{$file}++ && $require;
local(*FILE);
unless (open(FILE, $file)) {
print "% Can't include $file: $!\n";
print STDERR "$file: $!\n";
return;
}
print STDERR " " x $level;
print STDERR "include $file\n";
local($_);
while (<FILE>) {
if (/^%\s*(include|require)\s+\"([^\"]+)\"/) {
include($2, ($1 eq "require"), $level+1);
next;
}
print;
}
close(FILE);
}
Jump to Line
Something went wrong with that request. Please try again.