Change HasUtils to an MX::Declare class
Tomas Doran [Tue, 15 Dec 2009 20:55:44 +0000 (20:55 +0000)]
lib/Gitalist/Git/HasUtils.pm

index 99a2d61..4f16b5a 100644 (file)
@@ -1,27 +1,27 @@
-package Gitalist::Git::HasUtils;
-use Moose::Role;
+use MooseX::Declare;
 use Gitalist::Git::Util;
-use namespace::autoclean;
-
-sub BUILD {}
-after BUILD => sub {
-    my $self = shift;
-    $self->meta->get_attribute('_util')->get_read_method_ref->($self); # Force value build.
-};
-
-has _util => ( isa => 'Gitalist::Git::Util',
-               lazy => 1,
-               is => 'bare',
-               builder => '_build_util',
-               handles => [ 'run_cmd',
-                            'run_cmd_fh',
-                            'run_cmd_list',
-                            'get_gpp_object',
-                            'gpp',
-                        ],
-           );
-
-sub _build_util { confess(shift() . " cannot build _util") }
+
+role Gitalist::Git::HasUtils {
+
+    mehod BUILD { }
+    after BUILD {
+        $self->meta->get_attribute('_util')->get_read_method_ref->($self); # Force value build.
+    }
+
+    has _util => ( isa => 'Gitalist::Git::Util',
+                   lazy => 1,
+                   is => 'bare',
+                   builder => '_build_util',
+                   handles => [ 'run_cmd',
+                                'run_cmd_fh',
+                                'run_cmd_list',
+                                'get_gpp_object',
+                                'gpp',
+                            ],
+               );
+
+    sub _build_util { confess(shift() . " cannot build _util") }
+}
 
 1;