Mailing List Archive

[interchange] Adjust relocate.pl to optionally remove the commented indicator line
commit 29b703829c325ae5222c93ee59e4ca307610c8aa
Author: David Christensen <david@endpoint.com>
Date: Thu Nov 2 12:06:34 2017 -0500

Adjust relocate.pl to optionally remove the commented indicator line

relocate.pl | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/relocate.pl b/relocate.pl
index ac9617e..cfce340 100644
--- a/relocate.pl
+++ b/relocate.pl
@@ -9,8 +9,29 @@

=for example

-use lib '/home/jon/interchange/lib';
-#use lib '~_~INSTALLPRIVLIB~_~';
+Original:
+
+ #use lib '~_~INSTALLPRIVLIB~_~';
+
+Output:
+
+ use lib '/home/jon/interchange/lib';
+ #use lib '~_~INSTALLPRIVLIB~_~';
+
+=cut
+
+# If the leading comment starts with #- then the output of the original
+# commented line will be suppressed.
+
+=for example
+
+Original:
+
+ #-use lib '~_~INSTALLPRIVLIB~_~';
+
+Output:
+
+ use lib '/home/jon/interchange/lib';

=cut

@@ -46,7 +67,7 @@ DOIT: {
@ARGV = ($input) if $input;
local ($_) = <>;

- s{.*\n(#(.*)~_~(\w+)~_~(.*))}{$2 . doit($3) . "$4\n$1"}eg;
+ s{.*\n(#(-?)(.*)~_~(\w+)~_~(.*))}{$3 . doit($4) . $5 . ($2 ? '' : "\n$1" )}eg;

if ($output) {
open STDOUT, ">$output" or die "Error creating $output: $!\n";

_______________________________________________
interchange-cvs mailing list
interchange-cvs@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-cvs