home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / perl / 5307 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  2.0 KB

  1. Path: sparky!uunet!usc!news!netlabs!lwall
  2. From: lwall@netlabs.com (Larry Wall)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: write/format bug
  5. Message-ID: <1992Aug14.001147.17639@netlabs.com>
  6. Date: 14 Aug 92 00:11:47 GMT
  7. References: <RICKB.92Aug12173851@farfle.farfle.asd.sgi.com>
  8. Sender: news@netlabs.com
  9. Distribution: comp
  10. Organization: NetLabs, Inc.
  11. Lines: 46
  12. Nntp-Posting-Host: scalpel.netlabs.com
  13.  
  14. In article <RICKB.92Aug12173851@farfle.farfle.asd.sgi.com> rickb@farfle.farfle.asd.sgi.com (Rick Braumoeller) writes:
  15. : A Perl script that I use goes into several directories and
  16. : collects information about the files in them.  It then summarizes
  17. : using "write".  Sometimes the information can be multi-lined,
  18. : so I'd like to get output like this:
  19. : Directory  |  Comments
  20. : -----------+----------------------------------
  21. : dir1       |  This and that
  22. : foo        |  A longer comment, that spans two
  23. :            |  lines
  24. : For this, I am using the following format:
  25. : format STDOUT =
  26. : @<<<<<<<<< |  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  27. : $dir,         $results{$dir}
  28. : ~~         |  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  29. :               $results{$dir}
  30. : .
  31. : However, when I run with this format, Perl goes into some kind
  32. : of infinite loop when I do the first 'write' - slowly
  33. : consuming memory.  If I get rid of the | from the continuation
  34. : line, like this,
  35. : format STDOUT =
  36. : @<<<<<<<<< |  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  37. : $dir,         $results{$dir}
  38. : ~~            ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  39. :               $results{$dir}
  40. : .
  41. : everything works fine, but my output isn't as nice.
  42. : Have I stumbled on something?  If you can't reproduce this
  43. : behavior, I'll gladly forward my script to you.
  44.  
  45. The current implementation detects blank lines by checking to see
  46. if the line is blank after inserting all the fields.  In Perl 5
  47. this will be revised so that a line is considered blank if none
  48. of its @ or ^ fields interpolated anything (expect whitespace).
  49. If I manage to put out another patch for version 4 it'll include
  50. that change.
  51.  
  52. Larry
  53.