[SCM] libmessage-passing-perl Debian packaging branch, master, updated. debian/0.111-3-14-g44f6e88
Tomas Doran
bobtfish at bobtfish.net
Mon May 6 11:57:12 UTC 2013
The following commit has been merged in the master branch:
commit 633b5f8c74e1214c31c02f040dd21d260111d010
Author: Tomas Doran <bobtfish at bobtfish.net>
Date: Sun Jun 10 17:19:41 2012 +0100
Add Message::Passing::Output::IO::Handle
diff --git a/lib/Message/Passing/Output/IO/Handle.pm b/lib/Message/Passing/Output/IO/Handle.pm
new file mode 100644
index 0000000..11da874
--- /dev/null
+++ b/lib/Message/Passing/Output/IO/Handle.pm
@@ -0,0 +1,77 @@
+package Message::Passing::Output::IO::Handle;
+use Moose;
+use Moose::Util::TypeConstraints;
+use namespace::autoclean;
+
+with 'Message::Passing::Role::Output';
+
+has fh => (
+ isa => duck_type([qw/ print /]),
+ is => 'ro',
+ required => 1,
+);
+
+has append => (
+ is => 'ro',
+ default => sub { "\n" },
+);
+
+sub consume {
+ my $self = shift;
+ $self->fh->print(shift() . $self->append);
+}
+
+__PACKAGE__->meta->make_immutable;
+1;
+
+=head1 NAME
+
+Message::Passing::Output::IO::Handle - output to an IO handle
+
+=head1 SYNOPSIS
+
+ my $out = Message::Passing::Output::IO::Handle->new(
+ fh => \*STDOUT,
+ append => "\n",
+ );
+ # $out will now act like Message::Passing::Output::STDOUT
+
+=head1 DESCRIPTION
+
+Output messages to an L<IO::Handle> like handle, i.e. any class
+which implements a C<< ->print($stuff) >> method.
+
+=head1 ATTRIBUTES
+
+=head2 fh
+
+The file handle object. Required.
+
+=head2 append
+
+String to append to each message. Defaults to "\n"
+
+=head1 METHODS
+
+=head2 consume
+
+Consumes a message by printing it, followed by \n
+
+=head1 SEE ALSO
+
+L<Message::Passing>
+
+=head1 SPONSORSHIP
+
+This module exists due to the wonderful people at Suretec Systems Ltd.
+<http://www.suretecsystems.com/> who sponsored its development for its
+VoIP division called SureVoIP <http://www.surevoip.co.uk/> for use with
+the SureVoIP API -
+<http://www.surevoip.co.uk/support/wiki/api_documentation>
+
+=head1 AUTHOR, COPYRIGHT AND LICENSE
+
+See L<Message::Passing>.
+
+=cut
+
diff --git a/t/00_compile.t b/t/00_compile.t
index c4662fe..8336984 100644
--- a/t/00_compile.t
+++ b/t/00_compile.t
@@ -14,6 +14,8 @@ use_ok('Message::Passing::Output::Null');
use_ok('Message::Passing::Output::Callback');
use_ok('Message::Passing::Output::Test');
use_ok('Message::Passing::Output::File');
+use_ok('Message::Passing::Output::IO::Handle');
+use_ok('Message::Passing::Output::STDERR');
use_ok('Message::Passing::Filter::Null');
use_ok('Message::Passing::Filter::All');
use_ok('Message::Passing::Filter::Delay');
diff --git a/t/author/spelling.t b/t/author/spelling.t
index 0d4dc41..e305947 100644
--- a/t/author/spelling.t
+++ b/t/author/spelling.t
@@ -4,6 +4,7 @@ use Test::More;
use Test::Spelling;
add_stopwords(qw(
+ fh
privileged
conf
daemonize
--
libmessage-passing-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list