home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 4970 < prev    next >
Encoding:
Text File  |  1992-07-26  |  1.9 KB  |  54 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!wupost!psuvax1!flee
  3. From: flee@cs.psu.edu (Felix Lee)
  4. Subject: Re: Perl meets shell
  5. Message-ID: <Bs0yBv.3zw@cs.psu.edu>
  6. Sender: news@cs.psu.edu (Usenet)
  7. Nntp-Posting-Host: dictionopolis.cs.psu.edu
  8. References: <Brs2rD.Fz1@cs.psu.edu> <1992Jul24.160750.22163@news.eng.convex.com>
  9. Date: Mon, 27 Jul 1992 02:47:49 GMT
  10. Lines: 42
  11.  
  12. Tom Christiansen writes of "exechook".
  13.  
  14. It's a good idea, but I'm not sure I really like it.
  15.  
  16. There's a minor maintenance problem, in keeping the links to exechook
  17. in sync with your Perl library.
  18.  
  19. About repeated application to STDIN, Tom writes:
  20. > What I don't like about this is that it makes no allowance
  21. > for routines that get no arguments by their very nature.  
  22.  
  23. This is why I have two different front-ends, "perl-map" and
  24. "perl-apply".
  25.     perl-apply substr "abcd" 0 1
  26. v.
  27.     perl-map sqrt 1 2 3 4 5 6 7 8
  28. and
  29.     cat data | perl-map sqrt
  30.  
  31. perl-apply is straight subroutine call, but perl-map creates a filter,
  32. which is generally sensible for shell use.
  33.  
  34. Right now, I think I use "perl-apply" and "perl-map" mostly for
  35. testing.  It's convenient to create a temporary alias
  36.     alias t 'perl-apply file:function'
  37. and run test cases by hand.
  38.  
  39. The distinction between "perl-apply" and "perl-map" is one reason why
  40. I feel the front-end code should be embedded in the Perl modules.
  41. Each Perl module is better able to create a sensible shell usage for
  42. itself than any generic front-end can.
  43.  
  44. Looking at it from the other end, I have standalone Perl programs that
  45. I want to embed in other Perl programs, with 'require'.  This is the
  46. same problem, with the same solution.
  47.  
  48. Niklaus Wirth's Oberon language, in the Oberon environment, doesn't
  49. have a distinction between "programs" and "functions".  Running a
  50. program is simply calling a function in some module.  Lisp systems
  51. also lack this distinction.  The Unix environment is no help at all in
  52. this, and even deliberately makes things difficult.
  53. --
  54.