[Bps-public-commit] r12220 - in Prophet/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Sat May 10 21:20:32 EDT 2008


Author: sartak
Date: Sat May 10 21:20:31 2008
New Revision: 12220

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/CLI.pm

Log:
 r55531 at onn:  sartak | 2008-05-10 21:20:26 -0400
 Move edit_text and edit_hash from Prophet::CLI to Prophet::CLI::Command


Modified: Prophet/trunk/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI.pm	Sat May 10 21:20:31 2008
@@ -158,44 +158,6 @@
     }
 }
 
-=head2 edit_text [text] -> text
-
-Filters the given text through the user's C<$EDITOR> using
-L<Proc::InvokeEditor>.
-
-=cut
-
-sub edit_text {
-    my $self = shift;
-    my $text = shift;
-
-    require Proc::InvokeEditor;
-    return scalar Proc::InvokeEditor->edit($text);
-}
-
-=head2 edit_hash hashref -> hashref
-
-Filters the hash through the user's C<$EDITOR> using L<Proc::InvokeEditor>.
-
-No validation is done on the input or output.
-
-=cut
-
-sub edit_hash {
-    my $self = shift;
-    my $hash = shift;
-
-    my $input = join "\n", map { "$_: $hash->{$_}\n" } keys %$hash;
-    my $output = $self->edit_text($input);
-
-    my $filtered;
-    while ($output =~ m{^(\S+?):(.*)$}g) {
-        $filtered->{$1} = $2;
-    }
-
-    return $filtered;
-}
-
 package Prophet::CLI::Command;
 
 use base qw/Class::Accessor/;
@@ -244,6 +206,44 @@
     shift->cli->app_handle;
 }
 
+=head2 edit_text [text] -> text
+
+Filters the given text through the user's C<$EDITOR> using
+L<Proc::InvokeEditor>.
+
+=cut
+
+sub edit_text {
+    my $self = shift;
+    my $text = shift;
+
+    require Proc::InvokeEditor;
+    return scalar Proc::InvokeEditor->edit($text);
+}
+
+=head2 edit_hash hashref -> hashref
+
+Filters the hash through the user's C<$EDITOR> using L<Proc::InvokeEditor>.
+
+No validation is done on the input or output.
+
+=cut
+
+sub edit_hash {
+    my $self = shift;
+    my $hash = shift;
+
+    my $input = join "\n", map { "$_: $hash->{$_}\n" } keys %$hash;
+    my $output = $self->edit_text($input);
+
+    my $filtered;
+    while ($output =~ m{^(\S+?):(.*)$}g) {
+        $filtered->{$1} = $2;
+    }
+
+    return $filtered;
+}
+
 package Prophet::CLI::Command::Create;
 use base qw/Prophet::CLI::Command/;
 



More information about the Bps-public-commit mailing list