Getting started with Pod::Weaver

43
Pod::Weaver Module author: Ricardo Signes Talk author: Joshua Keroes Date: 13 Sep 2012

Transcript of Getting started with Pod::Weaver

Page 1: Getting started with Pod::Weaver

Pod::WeaverModule author: Ricardo SignesTalk author: Joshua KeroesDate: 13 Sep 2012

Page 2: Getting started with Pod::Weaver

Who likes to write documentation?

http://www.flickr.com/photos/bensonkua/2687804310/

2

Page 3: Getting started with Pod::Weaver

What sucks about documentation?

3

Page 4: Getting started with Pod::Weaver

It violates the DRY rule.

What sucks about documentation?

3

Page 5: Getting started with Pod::Weaver

It violates the DRY rule.

What sucks about documentation?

3

Page 6: Getting started with Pod::Weaver

What else sucks?

4

Page 7: Getting started with Pod::Weaver

What else sucks?

POD is too verbose.

=head1 FUNCTIONS

=over

=item frowny()

Returns a frowny face.

=back4

Page 8: Getting started with Pod::Weaver

What else sucks?Let it all out.

=head1 COPYRIGHT AND LICENSE

Copyright (c) 1901 Fergie T. Sumtin.

All rights reserved.

5

Page 9: Getting started with Pod::Weaver

Templates to the rescue

6

Page 10: Getting started with Pod::Weaver

Templates to the rescue

POD::Weaver uses a template.

It’s called weaver.ini.

6

Page 11: Getting started with Pod::Weaver

weaver.ini [@Default]

[@Default]

7

Page 12: Getting started with Pod::Weaver

weaver.ini [@Default][@CorePrep]

[Name]

[Version]

[Region  / prelude]

[Generic / SYNOPSIS]

[Generic / DESCRIPTION]

[Generic / OVERVIEW]

[Collect / ATTRIBUTES]

command = attr

[Collect / METHODS]

command = method

[Leftovers]

[Region  / postlude]

[Authors] 8

Page 13: Getting started with Pod::Weaver

weaver.ini [@Default][EnsurePod5]

[H1Nester]

[Name]

[Version]

[Region  / prelude]

[Generic / SYNOPSIS]

[Generic / DESCRIPTION]

[Generic / OVERVIEW]

[Collect / ATTRIBUTES]

command = attr

[Collect / METHODS]

command = method

[Leftovers]

[Region  / postlude]

[Authors] 9

Page 14: Getting started with Pod::Weaver

weaver.ini [@Default][EnsurePod5]

[H1Nester]

[Name]

[Version]

[Region  / prelude]

[Generic / SYNOPSIS]

[Generic / DESCRIPTION]

[Generic / OVERVIEW]

[Collect / ATTRIBUTES]

command = attr

[Collect / METHODS]

command = method

[Collect / FUNCTIONS]

command = func

[Leftovers]

[Region  / postlude]

[Authors] 10

Page 15: Getting started with Pod::Weaver

weaver.ini [@Default][EnsurePod5]

[H1Nester]

[Name]

[Version]

[Region  / prelude]

[Generic / SYNOPSIS]

[Generic / DESCRIPTION]

[Generic / OVERVIEW]

[Collect / ATTRIBUTES]

command = attr

[Collect / METHODS]

command = method

[Collect / FUNCTIONS]

command = func

[Leftovers]

[Region  / postlude]

[Authors] 11

Page 16: Getting started with Pod::Weaver

[NAME]

=head1 NAME

Some::Package::Name - just a package

12

Page 17: Getting started with Pod::Weaver

[NAME]

=head1 NAME

Some::Package::Name - just a package

# PODNAME: Some::Package::Name

# ABSTRACT: just a package

13

Page 18: Getting started with Pod::Weaver

[NAME]

=head1 NAME

Some::Package::Name - just a package

package Some::Package::Name

# ABSTRACT: just a package

14

Page 19: Getting started with Pod::Weaver

[VERSION]

=head1 VERSION

version 1.234

15

Page 20: Getting started with Pod::Weaver

[Generic / SYNOPSIS][Generic / DESCRIPTION][Generic / OVERVIEW]

=head1 SYNOPSIS

my $p = Some::Package::Name->new;

say $p;

=head1 DESCRIPTION

A module that knows it’s own package name.

16

Page 21: Getting started with Pod::Weaver

[Collect / FUNCTIONS]command = func=head1 FUNCTIONS

=over

=item binge()

eats arguments

=item purge()

returns eaten args

=back

17

Page 22: Getting started with Pod::Weaver

[Collect / FUNCTIONS]command = func=head1 FUNCTIONS

=over

=item binge()

eats arguments

=item purge()

returns eaten args

=back

=func binge()

eats arguments

=func purge()

returns eaten args

18

Page 23: Getting started with Pod::Weaver

[Collect / METHODS]command = method=head1 METHODS

=over

=item new()

creates an object

=item spawn()

spawns an object

=back

19

Page 24: Getting started with Pod::Weaver

[Collect / METHODS]command = method=head1 METHODS

=over

=item new()

creates an object

=item spawn()

spawns an object

=back

=method new()

creates an object

=method spawn()

spawns an object

20

Page 25: Getting started with Pod::Weaver

[Collect / ATTRIBUTES]command = attr=head1 ATTRIBUTES

=over

=item torches()

number of torches

=item matches()

number of matches

=back

21

Page 26: Getting started with Pod::Weaver

[Collect / ATTRIBUTES]command = attr=head1 ATTRIBUTES

=over

=item torches()

number of torches

=item matches()

number of matches

=back

=attr torches()

number of torches

=attr matches()

number of matches

22

Page 27: Getting started with Pod::Weaver

[Region / prelude]

=begin :prelude

=end :prelude

=for :prelude …

weaver.ini

[Name]

[Version]

[Region / prelude]

[Generic / SYNOPSIS]

[Generic / DESCRIPTION]

23

Page 28: Getting started with Pod::Weaver

=head1 SUPPORT

For support, please send a self-addressed, stamped envelope to:

Joshua Keroes

Somewhere in

Portland, OR

weaver.ini

[Leftovers]

[Region / postlude]

[Authors]

[Legal]

[Leftovers]

24

Page 29: Getting started with Pod::Weaver

[Region / postlude]

=begin :postlude

=end :postlude

=for :postlude …

weaver.ini

[Leftovers]

[Region / postlude]

[Authors]

[Legal]

25

Page 30: Getting started with Pod::Weaver

[Authors]

=head1 AUTHORS

Colette O’Day <[email protected]>

weaver.ini

[Leftovers]

[Region / postlude]

[Authors]

[Legal]

26

Page 31: Getting started with Pod::Weaver

[Legal]

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Joshua Keroes.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

27

Page 32: Getting started with Pod::Weaver

Let’s sum up.

28

Page 33: Getting started with Pod::Weaver

Leaner POD

No more NAME

No more VERSION

No more AUTHORS

No more COPYRIGHT AND LICENSE

29

Page 34: Getting started with Pod::Weaver

Leaner POD

Cleaner subroutine definitions

=func

=method

=attr

30

Page 35: Getting started with Pod::Weaver

Beyond @Default

Page 36: Getting started with Pod::Weaver

Lists, the lazy way

weaver.ini

[@Default]

[-Transformer]

transformer = List

32

Page 37: Getting started with Pod::Weaver

Lists

=head1 SEE ALSO

=over 4

=item *

L<Your::Module>

=item *

L<Your::Package>

=back

33

Page 38: Getting started with Pod::Weaver

Pod::Weaver bullet lists

=head1 SEE ALSO

=over 4

=item *

L<Your::Module>

=item *

L<Your::Package>

=back

=head1 SEE ALSO

=for :list

* L<Your::Module>

* L<Your::Package>

34

Page 39: Getting started with Pod::Weaver

Pod::Weaver numeric lists

=head1 SEE ALSO

=over 4

=item *

L<Your::Module>

=item *

L<Your::Package>

=back

=head1 SEE ALSO

=for :list

1. L<Your::Module>

1. L<Your::Package>

35

Page 40: Getting started with Pod::Weaver

Pod::Weaver frontends

36

Page 41: Getting started with Pod::Weaver

Dist::Zilla

dist.ini

[PodWeaver]

37

Page 42: Getting started with Pod::Weaver

App::podweaver

Great for troubleshooting; bypassing Dist::Zilla

podweaver lib/path/to/file.pm

38

Page 43: Getting started with Pod::Weaver

References

This talk at SlideShare: http://xrl.us/jkeroespw

Dist::Zilla + Pod::Weaver http://xrl.us/dzilpw

What is Pod::Weaver 1? http://xrl.us/rjbspw1

What is POD::Weaver 2? http://xrl.us/rjbspw2

Falling in love with Pod::Weaver http://xrl.us/lovepw

39