Angharad has asked for the wisdom of the Perl Monks concerning the following question:
Any comments, suggestions much appreciated#!/usr/bin/perl use strict; use warnings; use CGI qw/:standard/; # Upload directory for files my $upload_dir = "uploadpath"; # Path to processing program my $program = "path/processprogram"; my $input_file = "inputfile.txt"; die "Usage: $0 INPUT_FILENAME\n" unless $input_file; die "Can't process '$upload_dir/$input_file': File does not exist!\n" unless -f "$upload_dir/$input_file"; # Create web page... print header, start_html("Processing file '$input_file' ..."), $/, h1("Processing file '$input_file' ..."), $/; chdir $upload_dir; open (PROG, "| $program") || die "Can't run '$program': $!\n"; print PROG "$input_file\n"; close(PROG); print p("OK"), end_html();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Premature end of script header error
by holli (Abbot) on Feb 15, 2006 at 12:46 UTC | |
|
Re: Premature end of script header error
by marto (Cardinal) on Feb 15, 2006 at 12:49 UTC | |
|
Re: Premature end of script header error
by wfsp (Abbot) on Feb 15, 2006 at 12:45 UTC | |
|
Re: Premature end of script header error
by derby (Abbot) on Feb 15, 2006 at 13:12 UTC | |
|
Re: Premature end of script header error
by CountZero (Bishop) on Feb 15, 2006 at 14:15 UTC | |
|
Re: Premature end of script header error
by olus (Curate) on Feb 15, 2006 at 14:30 UTC | |
|
Re: Premature end of script header error
by Angharad (Pilgrim) on Feb 15, 2006 at 12:52 UTC |