Skip to content

Commit

Permalink
Use DZP::PodWeaver.
Browse files Browse the repository at this point in the history
  • Loading branch information
yak1ex committed Oct 31, 2012
1 parent dbfa4bc commit 1327edf
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 62 deletions.
2 changes: 2 additions & 0 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ location = root
[NextRelease]
filename = Changes

[PodWeaver]

[OurPkgVersion]
[CheckVersionIncrement]
[PodSyntaxTests]
Expand Down
24 changes: 3 additions & 21 deletions lib/PPI/Transform/PackageName.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use warnings;

package PPI::Transform::PackageName;

# ABSTRACT: Subclass of PPI::Transform specific for modifying package names
# VERSION

use base qw(PPI::Transform);
Expand Down Expand Up @@ -43,10 +44,6 @@ sub document
__END__
=pod
=head1 NAME
PPI::Transform::PackageName - Subclass of PPI::Transform specific for modifying package names
=head1 SYNOPSIS
use PPI::Transform::PackageName;
Expand All @@ -58,31 +55,16 @@ PPI::Transform::PackageName - Subclass of PPI::Transform specific for modifying
This module is a subclass of PPI::Transform specific for modifying package name.
=head1 OPTIONS
=over 4
=item I<-package_name>
=option I<-package_name>
Specify code reference called for modifying arguments of C<package> statements.
The code reference is called for each argument.
Original is passed as $_ and it is expected that $_ is modified.
=item I<-word>
=option I<-word>
Specify code reference called for modifying bare words other than arguments of C<package> statement.
The code reference is called for each bare word.
Original is passed as $_ and it is expected that $_ is modified.
=back
=head1 AUTHOR
Yasutaka ATARASHI <yakex@cpan.org>
=head1 LICENSE
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
61 changes: 20 additions & 41 deletions lib/filtered.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
use strict;
use warnings;

package filtered; # for Pod::Weaver

# ABSTRACT: Apply source filter on external module
# VERSION

package filtered::hook; ## no critic (RequireFilenameMatchesPackage)

# VERSION
Expand Down Expand Up @@ -114,7 +119,6 @@ sub filtered::hook::INC

package filtered;

# VERSION

use Carp;

Expand Down Expand Up @@ -179,10 +183,6 @@ sub import
__END__
=pod
=head1 NAME
filtered - Apply source filter on external module
=head1 SYNOPSIS
# Apply source filter YourFilter.pm on Target.pm, then result can be used as FilteredTarget
Expand Down Expand Up @@ -212,44 +212,40 @@ Source filter has unlimited power to enhance Perl.
However, source filter is usually applied on your own sources.
This module enables you to apply source filter on external module.
=head1 OPTIONS
Rest of the options are passed to C<import> of filtered module.
=over 4
=item C<by>
=option C<by>
Mandatory. Specify a source filter module you want to apply on an external module.
=item C<with>
=option C<with>
Specify arguments passed to source filter. NOTE that this value is just embedded as a scalar string.
=item C<as>
=option C<as>
Specify the package name for the resultant filtered module.
This option can be omitted. If omitted, original names are used.
=item C<on>
=option C<on>
Mandatory. Specify a target module. C<on> keyword can be ommited if this is the last option.
=item C<use_ppi>
=option C<use_ppi>
If true, L<PPI> is used for replacement by C<as>. If PPI is available, defaults to true. Otherwise false.
=back
=option Others
Rest of the options are passed to C<import> of filtered module.
=head1 CAVEATS
=over 4
=begin :list
=item This module uses @INC hook.
= This module uses @INC hook.
For @INC hook, please consult C<perldoc -f require>. Hook itself is enabled in short period but it may affect other modules.
=item Replacement by C<as> is applied in limited context.
= Replacement by C<as> is applied in limited context.
If you specified C<as =E<gt> FilteredTarget, on =E<gt> Target>, the following codes:
Expand All @@ -265,29 +261,12 @@ are transformed into as follows:
Actually, only C<'\bpackage\s+Target\b'> and C<'\bTarget::\b'> are replaced if C<use_ppi> is false. C<'\bTarget\b'> in arguments of C<package> statements and bare words are replaced if C<use_ppi> is true.
=back
=end :list
=head1 SEE ALSO
=over 4
=item *
L<http://github.com/yak1ex/filtered> - Github repository
=item *
L<Filter::Simple> - Helper module to implement source filter
=back
=head1 AUTHOR
Yasutaka ATARASHI <yakex@cpan.org>
=head1 LICENSE
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=for :list
* L<http://github.com/yak1ex/filtered> - Github repository
* L<Filter::Simple> - Helper module to implement source filter
=cut
28 changes: 28 additions & 0 deletions weaver.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[-Transformer]
transformer = List

[@CorePrep]

[Name]
[Version]

[Region / prelude]

[Generic / SYNOPSIS]
[Generic / DESCRIPTION]

[Collect / OPTIONS]
command = option
[Collect / ATTRIBUTES]
command = attr
[Collect / METHODS]
command = method
[Collect / FUNCTIONS]
command = func

[Leftovers]

[Region / postlude]

[Authors]
[Legal]

0 comments on commit 1327edf

Please sign in to comment.