Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Re: "copy" not working with variables

Expand Messages
  • Jake Johnson
    ... Try using one variable only ie... $pathToPreviewFiles=$pathToPreviewFiles. /content ; $pathToLiveFiles=$pathToLiveFiles. /content ;
    Message 1 of 3 , May 28 1:21 AM
    • 0 Attachment
      On Fri, May 28, 2004 at 08:08:50AM -0000, daymobrew@... wrote:
      > --- In perl-beginner@yahoogroups.com, "doctormelodious" http://www.plutoid.com
      > <doctormelodious@y...> wrote:
      > > Greetings,
      > >
      > > (See the sample script fragments below)
      > >
      > > I am trying to use "Copy" in a CGI script. When I plug a variable
      > > (which I know to be good) containing a file location into the
      > > destination part of the "Copy" command, the script seems to be dying.
      > > All I get back is a blank HTML page However, when I hard-wire the
      > > same file location into the destination, it works. The file gets
      > > copied, and the script prints the rest of the stuff it's supposed to
      > > print to the browser.
      > >
      > > Any idea what I'm doing wrong??
      > >
      > > Thanks so much!
      > > Perry
      > >
      > >
      > > # EXAMPLE ONE: FAILS
      > >
      > > use File::Copy;
      > >
      > > .
      > > .
      > > .
      > >
      > > # DECLARE VARIABLES
      > >
      > > $pathToPreviewFiles = "/home/www/foo/editor/page00";
      > > $pathToLiveFiles = "/home/www/foo/editor/page" . "$FORM{'pnum'}";
      > >
      > > # WHEN I UNCOMMENT THE NEXT LINE AND PRINT THE
      > > # $PATHTOLIVEFILES VAR IT IS CORRECT
      > > # (IN THIS EXAMPLE IT'S "/home/www/foo/editor/page20")
      > >
      > > #print $pathToLiveFiles;
      > >
      > > # THE "COPY" LINE IS EVIDENTLY FAILING, BECAUSE
      > > # ALL I GET BACK IS AN EMPTY HTML DOCUMENT
      > >
      > > copy("$pathToPreviewFiles/content", "$pathToLiveFiles/content");
      > >
      > > .
      > > .
      > > .
      > >
      > > # PRINT STUFF TO THE BROWSER (NEVER MAKES IT THIS FAR)
      > > .
      > > .
      > > .
      > >
      > > ______________________________
      > >
      > > # EXAMPLE TWO: SUCCEEDS
      > >
      > > use File::Copy;
      > >
      > > .
      > > .
      > > .
      > >
      > > # DECLARE VARIABLES
      > >
      > > $pathToPreviewFiles = "/home/www/foo/editor/page00";
      > > $pathToLiveFiles = "/home/www/foo/editor/page" . "$FORM{'pnum'}";
      > >
      > >
      > > # WHEN I HARD-WIRE THE DESTINATION FILE LOCATION,
      > > # IT WORKS
      > >
      > >
      > copy("$pathToPreviewFiles/content","/home/www/foo/editor/page20/content");
      >
      Try using one variable only ie...
      $pathToPreviewFiles=$pathToPreviewFiles."/content";
      $pathToLiveFiles=$pathToLiveFiles."/content";
      copy($pathToPreviewFiles,$pathToLiveFiles);

      --
      Jake Johnson
      http://www.plutoid.com
    Your message has been successfully submitted and would be delivered to recipients shortly.