LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Odd behavior with Perl scripts (https://www.linuxquestions.org/questions/programming-9/odd-behavior-with-perl-scripts-486052/)

karwoski 09-22-2006 01:45 PM

Odd behavior with Perl scripts
 
I'm very new to programming in Perl (as in, only this week have I started) and I'm having an odd problem and I'm not sure if it's my code or if it's my configuration of Apache, but I'm thinking the code.

I'm trying to write a script to generate a signup sheet for setting up meeting times with a guest. I have a script that displays the current schedule and it has a form at the bottom that allows people to signup. The form asks for a name, office number and you choose a time from a list of checkboxes. When you click submit, it runs another script that takes the data in the form and appends it to an text file that holds all the appointments. It then redirects back to the original schedule page to show the updated schedule.

Aside from the usual bugs, it worked fine yesterday. I could display the initial page, fill in the form and clicking submit would append that data to the input file. I could then go back to the original page and see my new entry. Today, with an empty input file, I can display the initial script, fill in the form and click submit, it will append the input file, but instead of going back and displaying the initial schedule, when it tries to go to that link, Firefox gives me the Save file dialog to save the file, instead of running it in the browser. If I go and delete the input file and recreate it again, it works fine until I try to add data again.

Being a newbie, I don't know if this is my script or an Apache problem. I've changed permissions on all the files and folders and still have this problem.

Thanks for the help.

Todd

jiml8 09-24-2006 11:47 AM

sounds to me like an html header problem. You are constructing a message that the browser is interpreting as a download, rather than a page to display.

karwoski 09-24-2006 12:22 PM

I think that was the case. I actually figured out the problem this morning. I was running this script both in a browser and in a terminal window because I was putting extra print statements in to test variables and troubleshoot. Some of the print statements were above the HTML content info, so when the page was generated, there were extra text lines at the beginning of the file, which must have made it want to download instead of open. I was going between browser and terminal so much that I never picked up on the problem with those print statements.


All times are GMT -5. The time now is 09:04 PM.