PERL experts / Apache people! need some help

Discussion in 'OT Technology' started by NEOxMorpheus, Mar 20, 2006.

  1. NEOxMorpheus

    NEOxMorpheus Real OG

    Joined:
    Oct 24, 2001
    Messages:
    1,001
    Likes Received:
    0
    I got a PERL cgi program, and I want to append something to a file.
    Here's my code:

    open(DATA,">>order.txt") || die("Cannot write to file");
    print DATA "$order\n";
    close(DATA);

    When I run my program I don't get any errors, but nothing gets written into order.txt. I think it might be a problem with setting Write Permissions?
    I'm using Apache on Windows. any help?
     
  2. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    I usually put a space between the dealio: ">> order.txt"

    Don't think it matters though.

    Sounds like a permissions problem, indeed.
     
  3. col_panic

    col_panic calm like a bomb Moderator

    Joined:
    Sep 19, 2003
    Messages:
    188,160
    Likes Received:
    0
    Location:
    winter haven, fl
    use strict and warnings so you get a better idea of why it fails to write the file
     
  4. NEOxMorpheus

    NEOxMorpheus Real OG

    Joined:
    Oct 24, 2001
    Messages:
    1,001
    Likes Received:
    0
    ^^ using strict and warnings but still no errors
     
  5. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    You sure $order actually contains data? Use a debugger to check its value at the time of write. Or have you tried writing static, arbitrary data to that file?
     
  6. NEOxMorpheus

    NEOxMorpheus Real OG

    Joined:
    Oct 24, 2001
    Messages:
    1,001
    Likes Received:
    0
    thanks for the help. i'm a dumbass and i figured it out. i was looking in the wrong directory :uh:
     
  7. MassMan

    MassMan OT Supporter

    Joined:
    Aug 26, 2004
    Messages:
    26,257
    Likes Received:
    85
    Location:
    Cambridge, MA
    directory issue?
     
  8. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    :rofl:
     

Share This Page