[Israel.pm] How to "which" in Perl

David Baird david.baird at homemail.com
Mon Jan 26 01:16:16 PST 2004


Thank you Shlomi and Offer. FYI, I've settled on the following for my
GNU Make file:

-David

which_make = \
  for $$p (split q{;}, $$ENV{PATH}) { \
    for $$e (q{}, q{.exe}) { \
      print qq{$$p\\$(MAKE)} and exit \
        if -x qq{$$p/$(MAKE)} . $$e; \
    } \
  }

ifeq ($(MAKE),$(notdir $(MAKE)))
   MAKE := $(shell perl -e "$(which_make)" )
endif

all:
	@echo MAKE = $(MAKE)




More information about the Perl mailing list