[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:33 UTC 2013
The following commit has been merged in the master branch:
commit 0a14ed6ee9164b061c47ef05bf2e4c04523ee771
Author: Tomas Doran <bobtfish at bobtfish.net>
Date: Sun Aug 12 15:55:35 2012 +0100
New MooX::Options almost works for me
diff --git a/Makefile.PL b/Makefile.PL
index ac33764..b8783e7 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -21,7 +21,7 @@ requires 'AnyEvent';
requires 'AnyEvent::Handle::UDP';
requires 'Config::Any';
requires 'MooX::Types::MooseLike' => '0.08';
-requires 'MooX::Options' => '1.6';
+requires 'MooX::Options' => '3.2';
requires 'String::RewritePrefix';
requires 'JSON' => '2.0';
requires 'Try::Tiny';
diff --git a/lib/Message/Passing.pm b/lib/Message/Passing.pm
index 40d52d9..009c63a 100644
--- a/lib/Message/Passing.pm
+++ b/lib/Message/Passing.pm
@@ -28,12 +28,12 @@ sub new_with_config {
use MooX::Options creation_chain_method => 'new_with_config';
with
- CLIComponent( name => 'input', option => __PACKAGE__->can('option') ),
- CLIComponent( name => 'output', option => __PACKAGE__->can('option') ),
- CLIComponent( name => 'filter', default => 'Null', option => __PACKAGE__->can('option') ),
- CLIComponent( name => 'decoder', default => 'JSON', option => __PACKAGE__->can('option') ),
- CLIComponent( name => 'encoder', default => 'JSON', option => __PACKAGE__->can('option') ),
- CLIComponent( name => 'error', default => 'STDERR', option => __PACKAGE__->can('option') ),
+ CLIComponent( name => 'input' ),
+ CLIComponent( name => 'output' ),
+ CLIComponent( name => 'filter', default => 'Null' ),
+ CLIComponent( name => 'decoder', default => 'JSON' ),
+ CLIComponent( name => 'encoder', default => 'JSON' ),
+ CLIComponent( name => 'error', default => 'STDERR' ),
'Message::Passing::Role::Script';
option configfile => (
diff --git a/lib/Message/Passing/Role/CLIComponent.pm b/lib/Message/Passing/Role/CLIComponent.pm
index 109b4e8..121e4b3 100644
--- a/lib/Message/Passing/Role/CLIComponent.pm
+++ b/lib/Message/Passing/Role/CLIComponent.pm
@@ -7,6 +7,7 @@ use Package::Variant
use MooX::Types::MooseLike::Base qw/ Str /;
use JSON ();
use Try::Tiny qw/ try /;
+use MooX::Options ();
#use namespace::clean -except => 'CLIComponent';
sub make_variant {
@@ -17,13 +18,18 @@ sub make_variant {
my $has_default = exists $arguments{default};
my $default = $has_default ? $arguments{default} : undef;
- $arguments{'option'}->("$name" =>
+ my $_options_meta = {};
+ has "$name" => (
format => 's',
isa => Str,
is => 'ro',
# required => "$has_default" ? 0 : 1,
"$has_default" ? ( default => sub { "$default" } ) : (),
- );
+ );
+ $_options_meta->{$name} = { MooX::Options::_validate_and_filter_options(
+ format => 's',
+ "$has_default" ? ( default => sub { "$default" } ) : (),
+ ) };
has "${name}_options" => (
is => 'ro',
@@ -39,6 +45,13 @@ sub make_variant {
$str;
},
);
+ $_options_meta->{$name} = { MooX::Options::_validate_and_filter_options(
+ format => 's',
+ ) };
+ around( _options_meta => sub {
+ my ( $orig, $self ) = ( shift, shift );
+ return ( $self->$orig(@_), %$_options_meta );
+ });
}
1;
--
libmessage-passing-perl Debian packaging
More information about the Pkg-perl-cvs-commits
mailing list