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

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!walter!porthos!donner!rdm2
  3. From: rdm2@donner.uucp (24337-mcburnett)
  4. Subject: Re: UUDECODE and perl ...
  5. Organization: Bellcore, Livingston, NJ
  6. Date: Wed, 11 Nov 92 13:41:19 GMT
  7. Message-ID: <1992Nov11.134119.15928@porthos.cc.bellcore.com>
  8. References: <1992Nov10.231657.17411@morwyn.uucp>
  9. Sender: netnews@porthos.cc.bellcore.com (USENET System Software)
  10. Lines: 45
  11.  
  12. In article <1992Nov10.231657.17411@morwyn.uucp> forrie@morwyn.uucp (Forrest Aldrich) writes:
  13. >Someone was very kind and sent me a perl script which was supposed to
  14. >be able to 'cat' a file of combined uuencoded scripts, stripping all
  15. >the headers, etc., and placing them into one file to be decoded.
  16. >
  17. >I tried it, and it didn't work
  18. ...
  19. >Forrest
  20.  
  21. Hi All,
  22.  
  23. Here is what I use to "auto decode" articles.  First I must ensure that
  24. the articles are in the proper order.  (This could also be automated but
  25. I have never had the need.)  Once the articles are in the proper order
  26. (in one file or in several) I can execute "extract" which will recognize
  27. the beginning of a uuencoded seciton and pass it to uudecode.  My
  28. process uses the conventions that prevail in comp.binaries where a BEGIN
  29. code word preceeds the uuencoded stuff and an END follows it.
  30.  
  31. -Roe
  32.  
  33. Roe D McBurnett III Bellcore (908)699-2273 rdm2@chaucer.cc.bellcore.com
  34. #insert <std.disclamer>
  35.  
  36. ================cut here================
  37. #! /usr/local/bin/perl -S
  38. #extract will scan for uuendcoded stuff and feed it to uudecode
  39. open(_uud,"|uudecode");
  40. line: while (<>) {
  41.     if(/^BEGIN/){
  42.         $p = 'y';
  43.         next line;
  44.     }
  45.     if(/^END/){
  46.         $p = 'n';
  47.     }
  48.     if( /^begin/ || /^end/ || /Subject/ ){
  49.         print $_;
  50.     }
  51.     if($p eq 'y'){
  52.         print _uud $_;
  53.     }
  54. }
  55. Roe D McBurnett III Bellcore (908)699-2273 rdm2@chaucer.cc.bellcore.com
  56. #insert <std.disclamer>
  57.