flatten sclars
[gitmo/Moose-Autobox.git] / lib / Moose / Autobox / Scalar.pm
index cb25538..126bf3b 100644 (file)
@@ -5,7 +5,8 @@ our $VERSION = '0.01';
 
 with 'Moose::Autobox::String',
      'Moose::Autobox::Number';     
-     
+
+sub flatten { $_[0] }
 sub print { CORE::print $_[0] }
 sub say   { CORE::print $_[0], "\n" }
 1;
@@ -33,6 +34,15 @@ as the combination (union sort of) of a String and a Number.
 
 =item B<say>
 
+=item B<flatten>
+
+Flattening a scalar just returns the scalar.  This means that you can say:
+
+  my @array = $input->flatten;
+
+  # Given $input of 5, @array is (5);
+  # Given $input of [ 5, 2, 0], @array is (5, 2, 0)
+
 =back
 
 =head1 BUGS