package ActivePerl::DocTools::TOC::HTML::Podmaster;
use strict;
use warnings;
use ActivePerl::DocTools::TOC::HTML;
use base qw( ActivePerl::DocTools::TOC::HTML );
our $VERSION = 0.01;
# The ActivePerl guys commented out the pod for ActivePerl::DocTools, thus
# making things ugly, so I gots to fix that
sub new {
my $self = shift;
$self = $self->SUPER::new(@_);
$self->{'filez'}->{'ActivePerl'}='' unless exists $self->{'filez'}->{'ActivePerl'};
$self->{'filez'}->{'ActivePerl::DocTools'}='' unless exists $self->{'filez'}->{'ActivePerl::DocTools'};
$self->{'filez'}->{'ActivePerl::DocTools::TOC'}='' unless exists $self->{'filez'}->{'ActivePerl::DocTools::TOC'};
return $self;
}
sub boilerplate {q[
]. ( exists $_[0]->{"\0_boiler_links"} ? $_[0]->boiler_links() : "" ) }
sub library {
my( $self, $modulename, $turnIntoLink) = @_;
my $depth = " " x 2;
if( $modulename =~ /::/ ) {
$depth .= $modulename;
$depth =~ s{(.*?)::$turnIntoLink}{
$1::};
return $depth.qq[
$turnIntoLink];
}
return _folder(qq[
$turnIntoLink]);
}
sub library_container {
# warn "\n\nlibrary_container\n", sprintf join("\n",map{'%s'}1..@_) ,@_;
my ($self, $module, $show, $depth) = @_;
$depth = "";
if( $module =~ /::/ ) {
$depth = " $module";
$depth =~ s/^(.*?)::$show$/$1/;
$depth = qq[
$depth];
}
return $depth._folder($show);
}
sub _folder {
my ($text) = @_;
defined $text or die "no argument to _folder!";
return qq'

$text
\n';
}
our $dirbase = $ActivePerl::DocTools::TOC::dirbase;
*main::WriteTOC = \&WriteTOC; # forget Exporter
sub WriteTOC {
my $fh;
unless (open $fh, '>', "$dirbase/perltoc.html") {
warn "Unable to open $dirbase/perltoc.html for writing: $!\n";
return undef;
}
my $html_toc = ActivePerl::DocTools::TOC::HTML::Podmaster->new();
$html_toc->{"\0_boiler_links"} = 1 if @_;
print $fh $html_toc->TOC();
}
1;
=head1 NAME
ActivePerl::DocTools::TOC::HTML::Podmaster - better TOC than standard
=head1 SYNOPSIS
perl -MActivePerl::DocTools -e UpdateHTML()
perl -MActivePerl::DocTools::TOC::HTML::Podmaster -e WriteTOC()
perl -MActivePerl::DocTools -e UpdateHTML()
perl -MActivePerl::DocTools::TOC::HTML::Podmaster -e WriteTOC(1)
If you pass 1 to WriteTOC ActivePerl FAQ and Windows Scripting
part of the toc will also be printed (I avoid these ;)
=head1 DESCRIPTION
This is the ActivePerl::DocTools generated TOC according to podmaster.
Now you can hit Ctrl-F in your browser, and type in Data::Dumper
and actually find it.
Still looks pretty ;)
=head1 AUTHOR
podmaster of perlmonks.org fame
=head1 SEE ALSO
The sourcecode to ActivePerl::DocTools::TOC, ActivePerl::DocTools::TOC::HTML
=cut