From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4224 invoked from network); 22 Mar 2022 23:47:37 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 22 Mar 2022 23:47:37 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1647992857; b=Ck2G1WRH9uMGKa5Pz6BweIlLOxh6YoZIvGte9JYSoSFH6LOXfB2iDgm0lxV0K4eo8DqTl9mhYO PYb8RXjSQm18iD//TsT+1ziW4e7+Ug4FmJBOFZWKbANxStrr+ONngmjuff42GDX0EP8v1ROsEL MQQUXdnyX2Ym86ln59jswMbK96DuVzKtSXrq8TKYX2oZCYdrfKfj56Cn4uS8ZWSO9WMi1oRpBE bzfXQn6C0eNPq+RrIhbHwrxOE7xlyyXg6lFlBy+X5HYTtOntXzQ1LPpmgtQt80gSzg5LA8fbh/ Hl9RcyzpinwxrXcH3zvBJQVILtVfPlo54phZZ1tzS6a7JA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1647992857; bh=FGeamMU2949RYHC/g1ziw9tt+om8KWuC0ntP2pQXXdM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature: DKIM-Signature; b=Rviydt9D3nwdoa68BJbx7o3SRrEB7s4fCeBkyjKZ/w/dZP6IyYfOVfVDgLqphWCpB+yyna0k4E oZOhB4hHLuvf8O0BRl57/gBhxgMc+Ek93GNf9/PMH3Ys16nnsOTjAZY/zXyq47Qax2AJ6Okpzx s8DokA1zNTQeeF/3slCWKxeoAUtRwyyeHEfqPIxLeks1uAko0XGyf8c/f7cE0N/zZGeg9w3UlV YpSfyCgGmUNxvpeNyCbG7VFRbKw36MPLwh7N5qzZQRhciASk77KYH5YLSrXt5K2Ylpgxl+zDXG Qq/xpmk2E42ptLpGR5uZZ09DztCT3AerifoNNsq4hDoLJQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-Id:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=tx2wlvkVPPXMgLXKW9QF4c1XwXGnL2vXPTNYmGsmUj8=; b=TNwKJ+xVknScH8aUu7nC4lBVBD qHrvhmxFOosUqxT+dsnylT+5XZ1Cpv0TCaInqrgpoAGlaQarA5oL67jYHWC/6n2wVeab1IokOxObc HdAXcMf65C2oFR9U730AaF1heh3BXZCPXvSq9rBIStvPFF/g1o2ihzK4F0FwDCQIMDcd5e9Npsz52 pL4LBbMKKUFAEEy6POyi0Q2pH4KivtfzePRE/7PX3pSvjCkW2keXaTpxIlqf+lcSiXPb0LTgTRVZC yi8p/Sde8Aqd9XXhxnbORSJ9F62fC4ZANtiGgGDxvCThIP9zUwwubPGYWJWbFgUBm/lHlKP01t0YK AIhPMHlQ==; Received: from authenticated user by zero.zsh.org with local id 1nWoDw-000C9h-KV; Tue, 22 Mar 2022 23:47:36 +0000 Authentication-Results: zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none Received: from email.dondley.com ([34.203.132.18]:41622) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1nWoAu-000BMZ-QR; Tue, 22 Mar 2022 23:44:29 +0000 Received: from smtpclient.apple (unknown [216.193.141.189]) by email.dondley.com (Postfix) with ESMTPSA id 563A820580 for ; Tue, 22 Mar 2022 19:44:27 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dondley.com; s=default; t=1647992667; bh=FGeamMU2949RYHC/g1ziw9tt+om8KWuC0ntP2pQXXdM=; h=From:Subject:Date:References:To:In-Reply-To:From; b=cRRmoJzoHLlCnsTPWuRprlm4A77tEbrhmzb7BBpcB5ylvx4oR5oabK90vodg307JJ V11JiWzUjZG/JtB2MvdIk0/dpGJuk8lqYqvAJjqRDeWIF/uiYNRPguDoKPkMFC11tS lAV7lOPYUprPqrP3OjwV9hUnMFVLheb/HrWA90wzkvzTjF9Z+WZVQp779HRqJbmT1D 9uDM0TuwnPR/CQrRBDAcTlxeSoH+C8k44ZxWFiIg1YISKYfsnFvjLKTOHBA5K+lNQr Ad+Lt9szPgbgUKM06qs3MROnMumGkAJui6b/zHD9NAJO0Ye1849Se37I+8E9R+xlYq w8AttQbl9SWjQ== From: Steve Dondley Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Subject: Re: Suggestions for autogenerating function names to wrap the same code? Date: Tue, 22 Mar 2022 19:44:26 -0400 References: <38A2973E-E198-4E15-8DCF-C4C72EBC2B58@dondley.com> <63903B76-9716-44A9-ACAF-788F61A0E6DE@dondley.com> To: zsh-users@zsh.org In-Reply-To: <63903B76-9716-44A9-ACAF-788F61A0E6DE@dondley.com> Message-Id: <3283C909-8179-4C0E-AA8E-413FA804C68B@dondley.com> X-Mailer: Apple Mail (2.3696.80.82.1.1) X-Seq: 27607 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: OK, sorry for the noise. I introduced a bug in the script which = prevented any functions from getting called. Everything is good. Thanks = again! > On Mar 22, 2022, at 7:28 PM, Steve Dondley wrote: >=20 > OK, this is semi-working. The corresponding perl function is = definitely getting called. If I it has a syntax error, STDERR gets = output to the screen. >=20 > But for whatever reason, I can=E2=80=99t get any output on STDOUT with = something as simple as: >=20 > sub blah { > system('echo', 'hi'); > } >=20 >=20 >> On Mar 22, 2022, at 5:03 PM, Mikael Magnusson = wrote: >>=20 >> On 3/22/22, Steve Dondley wrote: >>> So I have these two functions: >>>=20 >>> function task() { >>> task_wrapper.pl $funcstack[1] "$@" >>> } >>>=20 >>> function tc() { >>> task_wrapper.pl $funcstack[1] "$@=E2=80=9C >>>=20 >>> } >>>=20 >>> They are both wrappers for the same perl script which does its thing = based >>> on the value of $funcstack[1]; >>>=20 >>> Works, but I=E2=80=99m wondering if I can spare myself the job = remembering to create >>> a new function for each and every new perl function I want to write. >>>=20 >>> I could write a little script to pull out the subroutine names from = the perl >>> script and dump them into a file sourced by zsh and then reload zsh. >>>=20 >>> Wondering if there might be some cool feature of zsh I don=E2=80=99t = know about to >>> assist with creating these functions on-the-fly. >>=20 >> You can define multiple functions like this: >> function f1 f2 f3 f4() { >> this body is shared by functions f1 f2 f3 and f4 >> } >>=20 >> and you can copy them like this (somewhat newer feature) >> functions -c f1 g1 >>=20 >> so if you can get all the function names in an array, you could just = say: >> task_func_names=3D( $(script to pull names out) ) >> function $task_func_names() { >> task_wrapper.pl $funcstack[1] "$@" >> } >>=20 >> --=20 >> Mikael Magnusson >>=20 >=20 >=20