Commits

Shlomi Fish  committed b4c9156

Add the -0 flag.

  • Participants
  • Parent commits 1bde558

Comments (0)

Files changed (2)

File Module-Format/Module-Format/lib/Module/Format/PerlMF_App.pm

 
     my $format = $ops_to_formats{$op};
 
+    my $delim = ' ';
+    my $suffix = "\n";
+
     if (! (my $ret = GetOptionsFromArray(
-        $argv
+        $argv,
+        '0!' => sub { $delim = "\0"; $suffix = q{}; },
     )))
     {
         die "GetOptions failed!";
         }
     );
 
-    print join(' ', @{$module_list_obj->format_as($format)}), "\n";
+    print join($delim, @{$module_list_obj->format_as($format)}), $suffix;
 
     return;
 }

File Module-Format/Module-Format/t/perlmf-app.t

     plan skip_all => "Test::Trap not found.";
 }
 
-plan tests => 4;
+plan tests => 5;
 
 # TEST
 ok(1, "Test is OK.");
         'deb works as expected.',
     );
 }
+
+{
+    trap(sub {
+        Module::Format::PerlMF_App->new(
+            {
+                argv => [qw/as_rpm_colon -0 Data::Dump XML-Grammar-Fortune/],
+            },
+        )->run();
+    });
+
+    # TEST
+    is (
+        $trap->stdout(), 
+        qq{perl(Data::Dump)\0perl(XML::Grammar::Fortune)},
+        'as_rpm_colon -0 works as expected.',
+    );
+}