add shallow_clone to Array and Hash traits
[gitmo/Moose.git] / lib / Moose / Meta / Method / Accessor / Native / Array / shallow_clone.pm
diff --git a/lib/Moose/Meta/Method/Accessor/Native/Array/shallow_clone.pm b/lib/Moose/Meta/Method/Accessor/Native/Array/shallow_clone.pm
new file mode 100644 (file)
index 0000000..484d271
--- /dev/null
@@ -0,0 +1,32 @@
+package Moose::Meta::Method::Accessor::Native::Array::shallow_clone;
+
+use strict;
+use warnings;
+
+use Params::Util ();
+
+use Moose::Role;
+
+with 'Moose::Meta::Method::Accessor::Native::Reader' => {
+    -excludes => [
+        qw(
+            _minimum_arguments
+            _maximum_arguments
+            )
+    ]
+};
+
+sub _minimum_arguments { 0 }
+
+sub _maximum_arguments { 0 }
+
+sub _return_value {
+    my $self = shift;
+    my ($slot_access) = @_;
+
+    return '[ @{ (' . $slot_access . ') } ]';
+}
+
+no Moose::Role;
+
+1;