home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1125 / ckp
Encoding:
Text File  |  1990-12-28  |  479 b   |  17 lines

  1. #!/usr/bin/perl
  2. eval "exec /usr/bin/perl -S $0 $*"
  3.     if $running_under_some_shell;
  4.  
  5. # ckp - check a Perl script (from STDIN) for syntax.
  6. # Perl switches may be supplied as optional arguments.
  7.  
  8. die unless open(IN,"-");    # get around program/data STDIN conflict
  9.  
  10. $pcmd = "perl" unless ($pcmd) = ($topline = <IN>) =~ /^#!\s*(.+)\s*$/;
  11. $pcmd .= " @ARGV" if @ARGV;
  12.  
  13. die unless open(CMD,"|$pcmd");
  14. print CMD "exit 0; ",$topline;
  15. while (<IN>) { print CMD; }    # conserve memory
  16. close(CMD);
  17.