[libcatmandu-perl] 41/46: Adding more POD
Jonas Smedegaard
dr at jones.dk
Tue Oct 14 13:52:55 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.9205
in repository libcatmandu-perl.
commit 825b8d7abbad14708ddbe428402a962c40650017
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date: Fri Oct 3 11:48:14 2014 +0200
Adding more POD
---
lib/Catmandu/Fixable.pm | 24 ++++++++--------
lib/Catmandu/Logger.pm | 28 +++++++++++--------
lib/Catmandu/Pluggable.pm | 70 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 98 insertions(+), 24 deletions(-)
diff --git a/lib/Catmandu/Fixable.pm b/lib/Catmandu/Fixable.pm
index 693379d..0880060 100644
--- a/lib/Catmandu/Fixable.pm
+++ b/lib/Catmandu/Fixable.pm
@@ -1,5 +1,17 @@
package Catmandu::Fixable;
+=head1 NAME
+
+Catmandu::Fixable - a Catmandu role to apply fixes
+
+=head1 DESCRIPTION
+
+This role provides a C<fix> attribute to apply fixes (instances of
+L<Catmandu::Fix>) to items processed by L<Catmandu::Importer>,
+L<Catmandu::Exporter>, and L<Catmandu::Bag>.
+
+=cut
+
use namespace::clean;
use Catmandu::Sane;
use Catmandu::Util qw(is_instance);
@@ -14,16 +26,4 @@ has _fixer => (
},
);
-=head1 NAME
-
-Catmandu::Fixable - a Catmandu role to apply fixes
-
-=head1 DESCRIPTION
-
-This role provides a C<fix> attribute to apply fixes (instances of
-L<Catmandu::Fix>) to items processed by L<Catmandu::Importer>,
-L<Catmandu::Exporter>, and L<Catmandu::Bag>.
-
-=cut
-
1;
diff --git a/lib/Catmandu/Logger.pm b/lib/Catmandu/Logger.pm
index b7c022a..3b6a98a 100644
--- a/lib/Catmandu/Logger.pm
+++ b/lib/Catmandu/Logger.pm
@@ -1,18 +1,8 @@
package Catmandu::Logger;
-use namespace::clean;
-use Catmandu::Sane;
-use Moo::Role;
-use Log::Any ();
+=head1 NAME
-local $| = 1;
-
-has 'log' => (is => 'lazy');
-
-sub _build_log {
- my ($self) = @_;
- Log::Any->get_logger(category => ref($self));
-}
+Catmandu::Logger - A role for classes that need logging capabilities
=head1 SYNOPSIS
@@ -96,4 +86,18 @@ Code and documentation blatantly stolen from C<MooX::Log::Any>.
=cut
+use namespace::clean;
+use Catmandu::Sane;
+use Moo::Role;
+use Log::Any ();
+
+local $| = 1;
+
+has 'log' => (is => 'lazy');
+
+sub _build_log {
+ my ($self) = @_;
+ Log::Any->get_logger(category => ref($self));
+}
+
1;
diff --git a/lib/Catmandu/Pluggable.pm b/lib/Catmandu/Pluggable.pm
index cb4ffa4..30e09c5 100644
--- a/lib/Catmandu/Pluggable.pm
+++ b/lib/Catmandu/Pluggable.pm
@@ -1,5 +1,75 @@
package Catmandu::Pluggable;
+=head1 NAME
+
+Catmandu::Pluggable - A role for claases that need plugin capabilities
+
+=head1 SYNOPSIS
+
+ package My::Foo::Bar;
+
+ use Role::Tiny;
+
+ before foo => sub {
+ print "Before foo!\n";
+ };
+
+ after foo => sub {
+ print "After foo!\n";
+ };
+
+ sub extra {
+ print "I can do extra too\n";
+ }
+
+ package My::Foo;
+
+ use Moo;
+
+ with 'Catmandu::Pluggable';
+
+ sub plugin_namespace {
+ 'My::Foo';
+ }
+
+ sub foo {
+ print "Foo!\n";
+ }
+
+ package main;
+
+ my $x = My::Foo->with_plugins('Bar')->new;
+
+ # prints:
+ # Before foo!
+ # Foo!
+ # After foo!
+ $x->foo;
+
+ # prints:
+ # I can do extra too
+ $x->extra;
+
+=head1 METHODS
+
+=head2 plugin_namespace
+
+Returns the namespace where all plugins for your class can be found.
+
+=head2 with_plugins(NAME)
+
+=head2 with_plugins(NAME,NAME,...)
+
+This class method returns a subclass of your class with all provided plugins NAME-s implemented.
+
+=head1 SEE ALSO
+
+L<Catmandu::Bag>,
+L<Catmandu::Plugin::Datestamps>,
+L<Catmandu::Plugin::Versioning>
+
+=cut
+
use Catmandu::Sane;
use Role::Tiny;
use namespace::clean;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-perl.git
More information about the Pkg-perl-cvs-commits
mailing list