--- "Brett W. McCoy" <[EMAIL PROTECTED]> wrote:
> On Tue, 5 Jun 2001, IT Dept - Terry Honeyford wrote: 
> > I have a really strange problem.
> > when my script is run it works fine except for the bit that moves a
> > company's config file. (shown below).
> > the server comes back with a server error page and the server error
> log says
> > :-
> > "the CGI program /admin_tfoak did not produce a valid header (name
> without
> > value: got line 'could not move file illegal seek at /admin_tfoak
> line
> > 322.")
> >
> > snip ->
> >
> > 320    if ($query->param("dcomp")) {
> > 321    &GETQUERYSTRINGVALUES;
> > 322    `mv /web/company_profiles/$company_id
> > /web/deleted_company_profiles/$company_id` or die "could not move
> file $!";
> > 323    &GETREWRITEUSERS_CTL;
> > 324    $content = "\<meta http-equiv=\"REFRESH\" content=\"1;
> > URL=admin_tfoak?display=admin_menu\">";
> > 325    }
> > snip -<
> 
> You should use the move function (in the File::Copy module) rather
> than
> the backticked system call, because this won't properly indicate a
> failure
> of the move.  You might be trying to move a file that has an open
> filehandle on it.  It is also generating an error message that the
> server
> thinks is a header, and it is screwing up your redirect.

c.f. :
> > 322    `mv /web/company_profiles/$company_id
> > /web/deleted_company_profiles/$company_id` or die "could not move
> file $!";

Backticks return the *output* of the command.
A successful mv probably has no output, so the following boolean test
fails, and the die() kills the script before the Content-type: header
or any real data has been sent.

Rewrite it as a Perl rename().

  rename $oldname, $newname or die $!;

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Reply via email to