Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit f50a83b6bfaacd31b387ee10e80d8103999a6a90 @friedo committed Dec 2, 2011
Showing with 139 additions and 0 deletions.
  1. +19 −0 README.pod
  2. +24 −0 dist.ini
  3. +75 −0 lib/Pod/Weaver/Section/Extends.pm
  4. +21 −0 weaver.ini
19 README.pod
@@ -0,0 +1,19 @@
+=head1 NAME
+
+Pod::Weaver::Section::Extends - Add a list of parent classes to your POD.
+
+=head1 VERSION
+
+version 0.001
+
+=head1 AUTHOR
+
+Mike Friedman <friedo@friedo.com>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2011 by Mike Friedman.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
24 dist.ini
@@ -0,0 +1,24 @@
+name = Pod-Weaver-Section-Extends
+author = Mike Friedman <friedo@friedo.com>
+license = Perl_5
+copyright_holder = Mike Friedman
+copyright_year = 2011
+
+version = 0.001
+
+[@Basic]
+[AutoPrereqs]
+
+[TestRelease]
+[ConfirmRelease]
+[PodWeaver]
+[PkgVersion]
+[PodVersion]
+[ModuleBuild]
+[MetaJSON]
+[Repository]
+
+[ReadmeAnyFromPod / pod.root ]
+ filename = README.pod
+ type = pod
+ location = root
75 lib/Pod/Weaver/Section/Extends.pm
@@ -0,0 +1,75 @@
+package Pod::Weaver::Section::Extends;
+
+use strict;
+use warnings;
+
+
+# ABSTRACT: Add a list of parent classes to your POD.
+
+use Moose;
+with 'Pod::Weaver::Role::Section';
+
+use aliased 'Pod::Elemental::Element::Nested';
+use aliased 'Pod::Elemental::Element::Pod5::Verbatim';
+use aliased 'Pod::Elemental::Element::Pod5::Command';
+
+use Data::Dumper;
+
+sub weave_section {
+ my ( $self, $doc, $input ) = @_;
+
+ my $file = $input->{filename};
+
+ # yeah, this is a stupid way to do it. it's only for generating
+ # docs though. shut up.
+ my $success = do $file;
+
+ die "Could not compile $file to find parent class data: $@ $!"
+ unless $success;
+
+ my $module = $file;
+ $module =~ s{^lib/}{}; # assume modules live under lib
+ $module =~ s{/}{::};
+ $module =~ s/\.pm//;
+
+ print "module = [$module]";
+
+ my @parents = $self->_get_parents( $module );
+
+ print "parents = " . Dumper \@parents;
+
+ return unless @parents;
+
+ my @pod = (
+ Command->new( {
+ command => 'over',
+ content => 4
+ } ),
+
+ map {
+ Command->new( {
+ command => 'item',
+ content => sprintf 'L<%s>', $_
+ } ),
+ } @parents
+ );
+
+ push @{ $doc->children },
+ Nested->new( {
+ type => 'command',
+ command => 'head1',
+ content => 'EXTENDS',
+ children => \@pod
+ } );
+
+}
+
+sub _get_parents {
+ my ( $self, $module ) = @_;
+
+ no strict 'refs';
+ return @{ $module . '::ISA' };
+}
+
+
+1;
21 weaver.ini
@@ -0,0 +1,21 @@
+[@CorePrep]
+
+[Name]
+[Version]
+
+[Region / prelude]
+
+[Generic / SYNOPSIS]
+[Generic / DESCRIPTION]
+[Generic / OVERVIEW]
+
+[Collect / METHODS]
+command = method
+
+[Leftovers]
+
+[Region / postlude]
+
+[Authors]
+[Legal]
+

0 comments on commit f50a83b

Please sign in to comment.