* [PATCH] script/*: shorten and point to docs
@ 2023-01-13 7:57 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-01-13 7:57 UTC (permalink / raw)
To: mwrap-perl
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);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-13 7:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 7:57 [PATCH] script/*: shorten and point to docs Eric Wong
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).