<%PERL>
my $dirname = File::Basename::dirname($INC{'RT.pm'});
$n =~ s/::/\//g;
$n = 'RT' unless -r "$dirname/$n.pm";
my $show = "$dirname/$n";
if (-r "$show.pm") {
local $/;
my $got_name = 0;
my $total_body = '';
foreach my $postfix ('', '_Overlay', '_Vendor', '_Local') {
my $fh;
next unless -r "$show$postfix.pm";
open $fh, "$show$postfix.pm" or next;
my $body = <$fh>;
if ($body =~ s/.*Create takes a hash of values and creates a row in the
database:([^=]+)//s) {
# okay, reduce it...
$body = "=head1 SCHEMA\n\n$1\n=head1 ACCESSORS\n\n\n=cut\n$body";
$body =~ s/=item/=head2/g;
}
elsif ($body =~ /^=item NewItem$/m and $n =~ /s$/) {
my $pkg = $n;
$pkg =~ s{/}{::}g;
chop $pkg;
$body = "=head1 NAME\n\n${pkg}s - Collection of $pkg
objects\n\n=cut\n";
$got_name++;
}
else {
$body =~ s/^=head1 NAME[^=]+//m if $got_name;
}
$body =~ s/^=head1\b(?! ACCESSORS).*\s*(?==(head1|cut))//mg;
$body =~ s/^=head1 (?:AUTHOR|SEE ALSO|SYNOPSIS)\s*[^=]+//mg;
$body =~ s/^=/\n=/mg;
$body =~ s/^=begin testing\n/=begin testing\n\n/mg;
close $fh;
$total_body .= $body;
}
my $body;
my $converter = Pod::Simple::HTML->new();
$converter->output_string(\$body);
$converter->parse_string_document($total_body);
$body =~ s{.*?]+>}{}s;
$body =~ s{\s*