home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 5040 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  1.6 KB

  1. Xref: sparky comp.lang.perl:5040 comp.unix.programmer:4019 comp.unix.shell:3210
  2. Path: sparky!uunet!wupost!usc!sol.ctr.columbia.edu!ursa!buzz
  3. From: buzz@toxicavenger.bear.com (Buzz Moschetti)
  4. Newsgroups: comp.lang.perl,comp.unix.programmer,comp.unix.shell
  5. Subject: A Tool Challenge...which lang is best?
  6. Message-ID: <BUZZ.92Jul30123306@toxicavenger.bear.com>
  7. Date: 30 Jul 92 16:33:06 GMT
  8. Sender: news@ursa.UUCP
  9. Reply-To: buzz@fsrg.bear.com
  10. Distribution: comp
  11. Organization: Bear, Stearns & Co. Inc.
  12. Lines: 45
  13.  
  14. I need a tool that returns a context-dependent value string given an input key.
  15. Below is a sample of the resource DB that is evaluated by this tool:
  16.  
  17. #
  18. #  Comment!
  19. #
  20. MRX.MACHINE        node1 \
  21.             dev!node2 \
  22.             test!node3
  23.  
  24. MRX.ROOTDIR        /tmp dev!/usr/tmp
  25.  
  26. MRX.NAME        user1 \
  27.             dev!"two names"
  28.  
  29. MRX.DB            $MRX.MACHINE:$MRX.ROOTDIR/the_db $MRX.NAME\
  30.             dev!$MRX.MACHINE:$MRX.ROOTDIR/other_db $MRX.NAME
  31.  
  32. Assuming the tool is called xxx, here are sample of the expected output:
  33.     $ xxx MRX.MACHINE
  34.     node1
  35.     $ xxx -domain test MRX.MACHINE
  36.     node3
  37.     $ xxx MRX.DB
  38.     node1:/tmp/the_db user1
  39.     $ xxx -domain dev MRX.DB
  40.     node2:/usr/tmp/other_db "two names"
  41.     $ xxx MRX
  42.     MACHINE node1
  43.     ROOTDIR /tmp
  44.     NAME uesr1
  45.     DB node1:/tmp/the_db
  46.     $
  47.  
  48. Notes:
  49. 1.  \ will escape the CR.
  50. 2.  The input key is always of the form "object.attribute."
  51. 3.  Fetching just the object returns all attributes and their values, one pair
  52.     to each line, separated by a space.
  53.  
  54. I can implement this tool using C, but I'd prefer not to if I can do it 
  55. using sh(1) and Un*x tools or perl, especially since the basic task of this
  56. tool seems to be variable interpolation.
  57.  
  58. Any suggestions?
  59.