aboutsummaryrefslogtreecommitdiff
path: root/lib/Net/Hawk/Role/WithUtils.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Net/Hawk/Role/WithUtils.pm')
-rw-r--r--lib/Net/Hawk/Role/WithUtils.pm24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/Net/Hawk/Role/WithUtils.pm b/lib/Net/Hawk/Role/WithUtils.pm
new file mode 100644
index 0000000..bd3a95d
--- /dev/null
+++ b/lib/Net/Hawk/Role/WithUtils.pm
@@ -0,0 +1,24 @@
+package Net::Hawk::Role::WithUtils;
+use strict;
+use warnings;
+use 5.010;
+use Package::Variant
+ importing => ['Moo::Role'],
+ subs => ['has'];
+use Types::Standard 1.000003 qw(HasMethods);
+
+sub make_variant {
+ my ($class,$target_package,@methods) = @_;
+
+ has _utils => (
+ is => 'ro',
+ (@methods ? ( isa => HasMethods[@methods] ) : () ),
+ init_arg => 'utils',
+ default => sub {
+ require Net::Hawk::Utils;
+ Net::Hawk::Utils->new;
+ },
+ );
+}
+
+1;