From 1776bd778db4f6ed72eed47602877ab7a8fb904f Mon Sep 17 00:00:00 2001 From: dakkar Date: Mon, 29 Aug 2011 13:54:58 +0100 Subject: reflectors, in box, and some refactor --- lib/Enigmatic/Role/WithWiring.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/Enigmatic/Role/WithWiring.pm (limited to 'lib/Enigmatic/Role/WithWiring.pm') diff --git a/lib/Enigmatic/Role/WithWiring.pm b/lib/Enigmatic/Role/WithWiring.pm new file mode 100644 index 0000000..df6dc48 --- /dev/null +++ b/lib/Enigmatic/Role/WithWiring.pm @@ -0,0 +1,17 @@ +package Enigmatic::Role::WithWiring; +use DAKKAR::p 'role'; + +requires 'BUILDARGS'; +requires 'wiring'; + +around BUILDARGS => sub { + my $orig = shift; + my $class = shift; + + if ( @_ == 1 && !ref $_[0] ) { + return $class->$orig( wiring => $_[0] ); + } + else { + return $class->$orig(@_); + } +}; -- cgit v1.2.3