In the example.txt, that was created by the same text editor that created
the script. As well, if I change the script to write to example.txt file (or
any file), and there is no file there to write to, it should create a file,
but it does not. I'll add the CGI::carp... and see what info I can glean
from there.

Thanks,

Mark

----- Original Message ----- 
From: "Adam Witney" <[EMAIL PROTECTED]>
To: "Mark Wheeler" <[EMAIL PROTECTED]>
Sent: Wednesday, September 24, 2003 10:14 AM
Subject: Re: File write/read problem


>
> Ah, good point! :-) although it may still be suffering line endings
problems
> in the example.txt file.
>
> Best thing would be to try what someone else suggested and get the errors
> onto the web page.. As was mentioned die errors do not show up.
>
> I used to add this line
>
> use CGI::Carp qw(fatalsToBrowser);
>
> to the top of the script, and this would send more errors to the
browser...
> (although I haven't tried it in a while and may not have all the syntax
> correct)
>
> Adam
>
>
>
> > Thanks for the link. It makes sense, but if there were line ending
problems,
> > wouldn't they be throughout the entire script, and thus the script
wouldn't
> > work at all? The script is running (no errors), it just can't read (or
> > write) files.
> >
> > Mark
> >
> > ----- Original Message -----
> > From: "Adam Witney" <[EMAIL PROTECTED]>
> > To: "Mark Wheeler" <[EMAIL PROTECTED]>
> > Sent: Wednesday, September 24, 2003 9:48 AM
> > Subject: Re: File write/read problem
> >
> >
> >>
> >> This is a common problem when taking files from a PC onto the mac...
You
> > can
> >> usually tell if they are the wrong line endings by opening up a
terminal
> > and
> >> just displaying the file using
> >>
> >> more perl.pl
> >>
> >> ... In the relevant directory
> >>
> >> I always use BBEdit to convert them... But you can add a line to your
perl
> >> code to take care of it I think... can't remember what at the moment
> >> though!!
> >>
> >> This may help though...
> >>
> >> http://bumppo.net/lists/macperl/1997/09/msg00039.html
> >>
> >> Remember to check example.txt as well for the correct endings
> >>
> >> Adam
> >>
> >>
> >>> Well, I've been using this editor for about a year, now, and have not
> > had a
> >>> problem with line-endings on my other hosts before. What should I look
> > for
> >>> to check the line-endings?
> >>>
> >>> Mark
> >>>
> >>> ----- Original Message -----
> >>> From: "Adam Witney" <[EMAIL PROTECTED]>
> >>> To: "Mark Wheeler" <[EMAIL PROTECTED]>
> >>> Sent: Wednesday, September 24, 2003 9:26 AM
> >>> Subject: Re: File write/read problem
> >>>
> >>>
> >>>>
> >>>> But if you wrote it on a PC then it probably has PC line endings, not
> >>> unix.
> >>>> You will probably need to convert them first to unix line endings.
> >>>>
> >>>>
> >>>>> Yes, I am running this as a cgi. I called it from a web browser. IE
6
> > on
> >>> a
> >>>>> PC. Yes, the script has no Mac line endings. I wrote it on a PC
using
> > a
> >>> text
> >>>>> editor. I've done nothing different than I have for all my other
> >>> scripts. I
> >>>>> just don't understand. Here is the  path:
> >>>>>
> >>>>> tonedeaf.redirectme.net/cgi-bin/write.cgi
> >>>>>
> >>>>> The script is in the /Library/WebServer/CGI-Executables/ folder. I
can
> >>> get
> >>>>> other scripts to run fine, but just can't read or write files. Any
> > ideas
> >>> you
> >>>>> may have would be greatly appreciated.
> >>>>>
> >>>>> Thanks,
> >>>>>
> >>>>> Mark
> >>>>>
> >>>>> ----- Original Message -----
> >>>>> From: "Hannes" <[EMAIL PROTECTED]>
> >>>>> To: <[EMAIL PROTECTED]>
> >>>>> Cc: "Mark Wheeler" <[EMAIL PROTECTED]>
> >>>>> Sent: Wednesday, September 24, 2003 8:35 AM
> >>>>> Subject: Re: File write/read problem
> >>>>>
> >>>>>
> >>>>>> On 9/24/03 6:37 AM, "Mark Wheeler" <[EMAIL PROTECTED]> wrote:
> >>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> This is my first post to this group. Please forgive me if this is
> > the
> >>>>> wrong
> >>>>>>> group for this question.
> >>>>>>>
> >>>>>>> I've been coding for a short time (a year or so) and love it. I've
> >>> been
> >>>>>>> using other hosts for my scripts, and am now setting up my OSX
> > server.
> >>>>> I've
> >>>>>>> run into a snag. I can't figure it out. When I try to read (or
> > write,
> >>>>> for
> >>>>>>> that matter) to a file nothing happens. Below is an example
script.
> > If
> >>>>> the
> >>>>>>> file is there, nothing. If the files is not there, nothing. I get
> > the
> >>>>>>> initial print statement about the file contents, but that's it. Is
> >>> this
> >>>>> a
> >>>>>>> permissions problem? I've checked the permissions of the folder
and
> >>> it's
> >>>>>>> 775, everything looks good. What am I missing.
> >>>>>>>
> >>>>>>> Again, forgive me if this post is misplaced.
> >>>>>>>
> >>>>>>> Mark
> >>>>>>>
> >>>>>>> --------------------------
> >>>>>>> #!/usr/bin/perl -w
> >>>>>>>
> >>>>>>> use strict;
> >>>>>>>
> >>>>>>> print "Content-type: text/html\n\n";
> >>>>>>>
> >>>>>>> print "The contents of the file: <br><br>";
> >>>>>>>
> >>>>>>> open (DATA, "example.txt") || die ("Could not open file <br> $!");
> >>>>>>> my @text = <DATA>;
> >>>>>>> print @text;
> >>>>>>> close (DATA);
> >>>>>>>
> >>>>>>> exit;
> >>>>>>>
> >>>>>>> ---------------------------
> >>>>>>
> >>>>>> The above runs for me just fine (perl 5.8.0/ 10.2.8) from within
> >>> bbedit.
> >>>>>> Since you get the initial statement - e.g. Part of your program are
> >>>>> actually
> >>>>>> run through the interpreter I assume that you've taken care of the
> > path
> >>> to
> >>>>>> perl and also made sure you got Unix and NOT Mac line breaks. You
> >>> probably
> >>>>>> intend to run this as a cgi script - thus how did you actually run
> > the
> >>>>>> script?
> >>>>>>
> >>>>>> /h
> >>>>>>
> >>>>>
> >>>>
> >>>>
> >>>> -- 
> >>>> This message has been scanned for viruses and
> >>>> dangerous content by MailScanner, and is
> >>>> believed to be clean.
> >>>>
> >>>
> >>
> >>
> >> -- 
> >> This message has been scanned for viruses and
> >> dangerous content by MailScanner, and is
> >> believed to be clean.
> >> Mailscanner thanks transtec Computers for their support.
> >>
> >
>
>
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>

Reply via email to