mwrap (Perl version) user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: mwrap-perl@80x24.org
Subject: [PATCH] script/*: shorten and point to docs
Date: Fri, 13 Jan 2023 07:57:20 +0000	[thread overview]
Message-ID: <20230113075720.2857889-1-e@80x24.org> (raw)

Try to keep these scripts as short as possible so it's easier to
find the manpage.  For -rproxy, I guess a small note at the top
will have to do...
---
 script/mwrap-decode-csv |  1 -
 script/mwrap-perl       | 23 ++++++++---------------
 script/mwrap-rproxy     |  2 +-
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/script/mwrap-decode-csv b/script/mwrap-decode-csv
index 5bbc171..ad73b8c 100644
--- a/script/mwrap-decode-csv
+++ b/script/mwrap-decode-csv
@@ -1,7 +1,6 @@
 #!perl -w
 # Copyright (C) mwrap hackers <mwrap-perl@80x24.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
-# addr2line decoder for the output of MWRAP=dump_csv:$FILENAME
 use v5.12;
 use Devel::Mwrap::Rproxy;
 use IO::Handle;
diff --git a/script/mwrap-perl b/script/mwrap-perl
index c9a5666..632deaf 100644
--- a/script/mwrap-perl
+++ b/script/mwrap-perl
@@ -1,24 +1,17 @@
-#!/usr/bin/perl -w
+#!perl -w
 # Copyright (C) mwrap hackers <mwrap-perl@80x24.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
 use v5.12;
 use Devel::Mwrap;
-my ($so) = grep(m!/Mwrap\.so\z!, @DynaLoader::dl_shared_objects);
-defined($so) or die 'Mwrap.so not loaded';
-my $cur = $ENV{LD_PRELOAD};
+my ($so) = grep(m!/Mwrap\.so\z!, @DynaLoader::dl_shared_objects)
+	or die 'Mwrap.so not loaded';
 if (!@ARGV || ($ARGV[0] // '') =~ /\A(?:-h|--help)\z/) {
-	require Pod::Usage;
-	Pod::Usage::pod2usage(@ARGV ? 0 : 1);
+	require Pod::Usage; Pod::Usage::pod2usage(@ARGV ? 0 : 1);
 }
-if (defined $cur) {
-	my @cur = split(/[: \t]+/, $cur);
-	if (!grep(/\A\Q$so\E\z/, @cur)) {
-		# drop old redundant versions
-		my @keep = grep(!m!/Mwrap\.so$!, @cur);
-		$ENV{LD_PRELOAD} = join(':', $so, @keep);
-	}
-} else {
-	$ENV{LD_PRELOAD} = $so;
+my @cur = split(/[: \t]+/, $ENV{LD_PRELOAD} // '');
+if (!grep(/\A\Q$so\E\z/, @cur)) { # drop old redundant versions
+	my @keep = grep(!m!/Mwrap\.so$!, @cur);
+	$ENV{LD_PRELOAD} = join(':', $so, @keep);
 }
 exec @ARGV;
 __END__
diff --git a/script/mwrap-rproxy b/script/mwrap-rproxy
index 056e80a..57fdde7 100644
--- a/script/mwrap-rproxy
+++ b/script/mwrap-rproxy
@@ -1,7 +1,7 @@
 #!perl -w
 # Copyright (C) mwrap hackers <mwrap-perl@80x24.org>
 # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt>
-# thin wrapper for Devel::Mwrap::Rproxy
+# thin wrapper for Devel::Mwrap::Rproxy (see __END__ below for manpage)
 use v5.12; # strict
 eval { require Plack::Runner } or die "Plack not installed: $@\n";
 use Getopt::Long qw(:config no_ignore_case no_auto_abbrev pass_through);

                 reply	other threads:[~2023-01-13  7:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230113075720.2857889-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=mwrap-perl@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mwrap-perl.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).