home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / perl / 6911 < prev    next >
Encoding:
Text File  |  1992-11-09  |  2.0 KB  |  48 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!caen!sol.ctr.columbia.edu!eff!ckd
  3. From: ckd@eff.org (Christopher Davis)
  4. Subject: Re: scripts should indicate the Perl version (a proposal)
  5. In-Reply-To: mcook@fendahl.dev.cdx.mot.com's message of Mon, 9 Nov 1992 16:32:03 GMT
  6. Message-ID: <CKD.92Nov9194435@loiosh.eff.org>
  7. Sender: usenet@eff.org (NNTP News Poster)
  8. Nntp-Posting-Host: loiosh.eff.org
  9. Organization: Electronic Frontier Foundation Tech Central
  10. References: <mcook.721326723@fendahl.dev.cdx.mot.com>
  11. Date: Tue, 10 Nov 1992 00:44:37 GMT
  12. Lines: 34
  13.  
  14. MC> == Michael Cook <mcook@fendahl.dev.cdx.mot.com> 
  15.  
  16.  MC> How about this idea: There should be a way to specify in a Perl
  17.  MC> script what version of Perl the script was written for.  Then, as
  18.  MC> new keywords and other non-backwardly-compatible functionality are
  19.  MC> added, old scripts could still likely work correctly.
  20.  
  21. How about assigning to $]?  That would handle both forward and backward
  22. compatibility issues:
  23.  
  24. #!/usr/bin/perl -- #-*-Perl-*-
  25.  
  26. # this script requires 4.0.35
  27. # and might break under 5.0 because it does undocumented bizarrities
  28. # so we'll force it to be compatible
  29.  
  30. $] = "4.0.35";
  31.  
  32. This would have an advantage over the traditional behavior of merely
  33. checking $] for the correct version: it would automatically be
  34. compatible.  Older versions (say, 3.0.18) would go out and ftp the
  35. newest package, compile it, and install it.  Newer versions (5.0) could
  36. lobotomize themselves as you suggested.  Everyone would be happy.
  37.  
  38. print "Just another ",$sarcastic,"perl hacker,";
  39.  
  40. (The real solution would be not to use lower case unquoted strings, and
  41. trust in Larry not to break anything.  Or hard-code the version, say:
  42. #!/usr/local/bin/perl4.035 -- #-*-Perl-*-)
  43. --
  44. Christopher K. Davis      | ``Usenet seems to run much like the Kif (or,
  45. <ckd@eff.org>   EFF #14   |   for the TV generation, Klingon) high command.
  46. System Administrator, EFF |   Whoever takes action and can be heard wins.''
  47. +1 617 864 0665  [CKD1]   |   --Peter da Silva <peter@ferranti.com>
  48.