[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Problems with message board script. Won't write to file correctly.



On Mon, Jun 29, 1998 at 06:20:39PM -0400, Matt Kraft wrote:
} I'm working on a message board script.  The script is like a normal message
} board except it is password protected, you can't post followup's, and when
} you are reading a message, you can see the subject's on the next 5 messages
} w/links and the subjects of the previous 5 messages w/links.  The only
} problem is, I'm happy trouble with the 5 next messages part.
} 
} This part of the script opens up the datafile, which contains a number and
} then gets the values of all the next numbers.  $first_prev is also equal to
} $num.  The script adds 1 to the datafile after the message is posted.
} ---
} # Get Prev & Next
} 
} sub get_prev {
}    open(NUMBER,"$basedir/$datafile");

You know that MacOS and MacPerl do not use Unix file system semantics,
right?  It's entirely legal to have a / in the file name, but some of
the path's below are probably getting awfully close or over the 32
character MacOS filename maximum length.  I'm not sure this is what's
happening, since you're checking all the opens, and I don't remember
what happens if you go over 32.  But if you're running this as a CGI,
I'd check the error log.

[snip]
} 
}    open(FIRST,"$basedir/$mesgdir/$first_prev\.$ext") || die $!;

}    open(FIRST,">$basedir/$mesgdir/$first_prev\.$ext") || die $!;
}    open(SECOND,"$basedir/$mesgdir/$second_prev\.$ext") || die $!;

etc.

I'd try rewriting all of these to use the Mac file path separator, :.
There's also no need to backslash the ".".  You'll probably also have
to convert the path part of an http URL to a local file path.  I'm not
running MacOS at the moment, so I can't give you a decent example, but
you can do this with URI::URL, part of the libwww-perl-5 package,
which comes with MacPerl.

} }
} ---
} Does anyone get this?  If you go to http://www.M-D-K.com/testboard/ you can
} see an example of this.  Open up one of the messages.  Then look at a
} previous message.  Also, the next/previous messages links do not work.
} Where the URL says wicnnewsboard, replace it with testboard.  This is just
} because as soon as it works I'm going to move it to the wicnnewsboard
} directory.
} 
} Matt Kraft
} MDK@M-D-K.com
} 

----
Paul Schinder
schinder@pobox.com

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch