home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / perl / 6969 < prev    next >
Encoding:
Internet Message Format  |  1992-11-13  |  1.2 KB

  1. Path: sparky!uunet!spool.mu.edu!umn.edu!cybrspc!roy
  2. From: roy%cybrspc@cs.umn.edu (Roy M. Silvernail)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: UUDECODE and perl ...
  5. Message-ID: <63H6TB1w165w@cybrspc.UUCP>
  6. Date: Thu, 12 Nov 92 18:05:04 CST
  7. References: <1992Nov11.134119.15928@porthos.cc.bellcore.com>
  8. Organization: Villa CyberSpace, Minneapolis, MN
  9. Lines: 30
  10.  
  11. rdm2@donner.uucp (24337-mcburnett) writes:
  12.  
  13. > Hi All,
  14. > Here is what I use to "auto decode" articles.
  15. [...]
  16. > ================cut here================
  17. > #! /usr/local/bin/perl -S
  18. > #extract will scan for uuendcoded stuff and feed it to uudecode
  19. > open(_uud,"|uudecode");
  20.  
  21. But why?  That's built in....
  22.  
  23. | #!/usr/bin/perl
  24. | $_ = <> until ($mode,$file) = /^begin\s*(\d*)\s*(\S*)/;
  25. | open(OUT,"> $file") if $file ne "";
  26. | while (<>) {
  27. |     last if /^end/;
  28. |     next if /[a-z]/;
  29. |     next unless int((((ord() - 32) & 077) + 2) / 3) == int(length() / 4);
  30. |     print OUT unpack("u", $_);
  31. | }
  32. | chmod oct($mode), $file;
  33.  
  34. (uudecode.pl courtesy of Randal Schwartz)
  35. --
  36. Roy M. Silvernail --  roy%cybrspc@cs.umn.edu - OR-  cybrspc!roy@cs.umn.edu
  37.                          "I'm a model citizen."
  38.                                       -- Warren Zevon
  39.