Add first and last
[gitmo/Moose-Autobox.git] / lib / Moose / Autobox / Array.pm
index e43c893..de9a3cc 100644 (file)
@@ -85,6 +85,14 @@ sub sort {
     [ CORE::sort { $sub->($a, $b) } @$array ]; 
 }    
 
+sub first {
+    $_[0]->[0];
+}
+
+sub last {
+    $_[0]->[$#{$_[0]}];
+}
+
 ## ::Indexed implementation
 
 sub at {
@@ -235,6 +243,10 @@ This is a role to describe operations on the Array type.
 
 =item B<flatten_deep ($depth)>
 
+=item B<first>
+
+=item B<last>
+
 =back
 
 =head2 Indexed implementation