I'm attempting to help based on the following assumptions:
- Your page is written as a CGI in Perl (just guessing by the fact that you're posting on PerlMonks
- Your flatfile is CSV or some other fairly simple format
- You're not asking how to design your database
If any of the above are false, let us know, and we'll probably
be able to help. In essense, what you should be doing to
prepare for when MySQL is available is writing wrappers to
encompass the common operations on your data. For your
guestbook example, perhaps you'll want to create functions
like:
- register_user($fullname, $login, $privlvl)
- add_new_comment($comment_target, $text, $login, $date)
- replace_comment($entryid, $newtext)
- get_login_from_fullname($fullname)
- get_fullname_from_login($login)
Initially, of course, implement them on your flatfile, but
start writing (and testing) SQL versions that work with
experimental versions of what the tables will be for
your guestbook. When the database is available, ideally
your SQL versions of the functions will be ready to go,
and after you import the existing data into the
database, there won't be any bumps.
I hope this answers your question. | [reply] |
Ooh, I guess they don't email you when you get a reply here. Sorry for the late reply;
To answer some of the questions of Improv, you nailed all three of those. I am using a .dat file, like a csv file I am assuming, I'm not doing this version in mysql, and I am using p
Yeerl no doubt.
Ok, here is an example of my .dat file:
<!--START:-->
<table width=500 border=0 cellpadding=5 cellspacing=0><tr><td>Signed o
+n: April 23, 2003</td></tr><tr><td>Name:Devin</td></tr><tr><td>E
+mail: <a href='mailto:'puckchewer@cs.com>puckchewer@cs.com</a><
+/td></tr><tr><td>Country:USA</td><tr><td>State/Province/Territory:&nb
+sp;Colorado</td></tr><tr><td>City: Loveland</td></tr><tr><td>Sit
+e rating: 10</td></tr><tr><td>Comments:<br>Testing my entry for
+the second time to see if the buffer turned off.</tr><tr><td></table>
<!--END:--><!--START:-->
<table width=500 border=0 cellpadding=5 cellspacing=0><tr><td>Signed o
+n: April 23, 2003</td></tr><tr><td>Name:Devin</td></tr><tr><td>E
+mail: <a href='mailto:'puckchewer@cs.com>puckchewer@cs.com</a><
+/td></tr><tr><td>Country:USA</td><tr><td>State/Province/Territory:&nb
+sp;Colorado</td></tr><tr><td>City: Loveland</td></tr><tr><td>Sit
+e rating: 10</td></tr><tr><td>Comments:<br>Testing my entry</tr>
+<tr><td></table>
<!--END:-->
Yes, I am completely aware that I should generate my HTML on the fly but I haven't had time to re-write the script in order to do that. My main problems are figuring out what I need to do to manipulate the strings (I'm sure I'm just thinking too hard) in order to break them into their separate messages. If you could possible give me what you would normally do in a case like this, that would definitely help. | [reply] [d/l] |
Actually, there's a preference you can set in your profile
that will at least make replies show up. Anyhow, yeah, this
doesn't look like the easiest format to parse, because
your data is all mixed into the HTML. The easiest way to
deal with this, IMO, is to parse the whole thing into
memory, and write it all back out if there are changes.
Unfortunately, this is also slow, but at least the code
will be clean. Here's code to do it:
| [reply] [d/l] |
Can you provide a sample data from your .dat file? Meanwhile you can read the manual for split and documentation for CGI.pm module.
Leonid Mamtchenkov | [reply] |
I think that you can use module File::Data
which is an interface to file data.
--------------------------------
SV* sv_bless(SV* sv, HV* stash);
| [reply] |