Mel,

I agree with the follow up posting on beginners that says this script should not be 
run as a CGI.  However, just as an FYI, that particular error was being generated by 
Apache because you weren't outputting an HTTP content type.

On another issue I see that you cross posted this message across many unrelated lists. 
 Including at least the datetime list.  Please don't spam the Perl lists with 
irrelevant questions.  beginners and beginners-cgi is the appropriate place to ask 
these kinds of question.  The Perl community is very supportive and people in that 
community want to help you.  Don't alienate those that you are asking for help.

Cheers,

-J

--

On Wed, 5 Mar 2003, mel awaisi wrote:

> Hi,
>
> I have with the help of one of the guys of this list got this script to take
> an image from one directory and then rename it with the time and date of the
> image and then store it onto a new directory.
>
> I sotred the image in the cgi-bin, and then tried to run the file, i got
> errors, when i went to the errorlog i got an error saying:
> Prematue end of script header: /home/httpd/cgi-bin.renamer.cgi
>
> Regards,
>
> Mel
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> =head1 NAME
>
> # renamer - renames files received by ftp, moving them to a new directory
>
> =head1 SYNOPSIS
>
>   nohup ./renamer image /home/httpd/htdocs /home/me/images jpg &
>
> =head1 DESCRIPTION
>
> #The above instructs renamer to look for files called image.jpg in
> /home/httpd/htdocs.
> #It checks once per minute for such a file to appear.  If it sees a
> #readable file called /home/httpd/htdocs.jpg it moves it to
> #/home/httpd/htdocs/image.200302251530.jpg where the number is a
> #time stamp with year (four digits), month, day of the month, hour (in
> #24 mode), and minute.
>
> #Read the bugs section closely.
>
> =head1 BUGS
>
> #The original and new directories must be on the same file system.
> #The program probably does not work on windows systems.
> #The daemon behavior is weak.
> #Not much testing has been done, so the script may have other problems.
>
> =cut
>
> my $usage = <<EOUSAGE;
> usage: $0 initial_name original_dir new_dir suffix
> example: $0 pic /home/httpd/htdocs /home/me/images jpg
> EOUSAGE
>
> my $check_file   = shift or die $usage;
> my $original_dir = shift or die $usage;
> my $new_dir      = shift or die $usage;
> my $suffix       = shift or die $usage;
>
> exit if (fork());
>
> while (1) {
>   process($check_file) if (-r "$original_dir/$check_file.$suffix");
>   sleep 60;
> }
>
> sub process {
>   my $file  = shift;
>   my ($hour, $min, $mon, $day, $year) = (localtime)[1..5];
>   $year += 1900;
>   $mon++;
>   my $stamp = "$year$mon$day$hour$min";
>
>   print
>     "renaming $original_dir/$file.$suffix to
> $new_dir/$file.$stamp.$suffix\n";
>   rename "$original_dir/$file.$suffix", "$new_dir/$file.$stamp.$suffix"
>       or warn "couldn't rename file $file to
> $new_dir/$file.$stamp.$suffix\n";
> }
>
>
> _________________________________________________________________
> It's fast, it's easy and it's free. Get MSN Messenger today!
> http://messenger.msn.co.uk
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to