automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [FYI 1/2] [ng] refactor: make '&verbatim' polymorphic in i


From: Stefano Lattarini
Subject: [Automake-NG] [FYI 1/2] [ng] refactor: make '&verbatim' polymorphic in its return value
Date: Mon, 30 Jul 2012 19:03:34 +0200

* automake.in (verbatim): If used in empty context, continue to act
as before, and append the read makefile fragment to '$output_verbatim'.
But if used in scalar or list context, return it instead.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/automake.in b/automake.in
index 4e6f02c..f6ae1a7 100644
--- a/automake.in
+++ b/automake.in
@@ -5830,7 +5830,18 @@ sub almost_verbatim ($%)
 sub verbatim ($)
 {
   my $name = shift;
-  $output_verbatim .= slurp_makefile_fragment ("$libdir/am/$name.am");
+  my $text .= slurp_makefile_fragment ("$libdir/am/$name.am");
+  if (defined wantarray)
+    {
+      # Scalar or list context.
+      return $text;
+    }
+  else
+    {
+      # Void context
+      $output_verbatim .= $text;
+      return;
+    }
 }
 
 # @PARAGRAPHS
-- 
1.7.12.rc0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]