-----Original Message----- From: Kate L Pugh [mailto:kake@earth.li] Sent: Friday, November 07, 2003 11:02 AM To: cgi-wiki-dev@earth.li Subject: Re: [cgi-wiki-dev] SQLite Backend
Blimey. ->write_node should not fail silently. The perldoc says:
Returns 1 on success, 0 on conflict, croaks on error.
If it's not doing that for you then that's a bug. Can you send me either as small a test case as possible or failing that all your code.
My mistake, I was not checking the returned value from write_node. I thought it would throw an error in the Apache error log.
I am wondering if it should do so. It'd mean an extra preliminary database call (to check table existence) every time you tried to write a node, which would increase load. Also if you typoed the database name you wouldn't be hitting the database you expected - which would be a right pain in the case of SQLite since it'd just create you a new database file and then you'd be wondering where all your data went.
Opinions on that please.
After looking around I found CGI::Wiki::Setup::SQLite module. Because of my newness with Perl and the CPAN I thought all needed modules and/or related modules would be listed in the webpage of CGI::Wiki at the cpan site, after finding the setup functions, it was smooth sailing. :)
The pointer to cgi-wiki-createdb is in INSTALL :) Should it be more prominent, or did you just forget to read that file? There's a *lot* of info in there. Maybe it should be in README too - would that have helped?
I used the command 'perl -MCPAN -e shell' to start a CPAN prompt and just did a 'install CGI::Wiki'; I never knew that there was a INSTALL doc to look at. I thought that the document on the www.cpan.org site was the INSTALL/README file, I guess I was wrong about that.
Oh, relating to this, Tom - do you want to take out the 'dbuser' requirement in CGI::Wiki::Kwiki and make a new release? I keep having to put dbuser => "thisisnotused" and it's bugging me :)
I tried this after finding the CGI::Wiki::Setup::SQLite module, just in case. It worked okay, I use the command without entering a username or password, just a file path.
Thanks for the info and help.
-Masroor
Kate L Pugh [mailto:kake@earth.li] wrote:
Blimey. ->write_node should not fail silently. The perldoc says:
Returns 1 on success, 0 on conflict, croaks on error.
On Fri 07 Nov 2003, "Naved, Masroor" mnaved@apdcryogenics.com wrote:
My mistake, I was not checking the returned value from write_node. I thought it would throw an error in the Apache error log.
If there is an actual database error, then the method will "croak". This means that unless your code catches it in an eval or something, then the error will indeed propagate on to the Apache error log.
It sounds like what happened to you was an edit conflict - the method returns false rather than croaking in this case to give you the choice of how to handle it gracefully.
An edit conflict happens when, for example, person A clicks on "edit this page" and slowly starts making changes, then person B clicks on "edit this page", makes a quick change and saves the page, then person A finishes their work and tries to save. If CGI::Wiki just let them save it, then person B's work would be lost. Instead, it returns false so that you can decide what to do. Your wiki application may do some clever merging of both people's edits, or it may just notify person A of what's happened and ask them to merge things in themselves, or it may do something else entirely. Your choice as the programmer of the wiki application.
After looking around I found CGI::Wiki::Setup::SQLite module. Because of my newness with Perl and the CPAN I thought all needed modules and/or related modules would be listed in the webpage of CGI::Wiki at the cpan site, after finding the setup functions, it was smooth sailing. :)
They're listed here, as are the README and INSTALL: http://search.cpan.org/~kake/CGI-Wiki/
I thought that the document on the www.cpan.org site was the INSTALL/README file, I guess I was wrong about that.
Are you sure you mean www.cpan.org and not search.cpan.org? I'm guessing here, but it sounds like what you did was to search on search.cpan.org and click on the link that said "CGI::Wiki". I find it's best to click on the slightly lower link that says "CGI-Wiki-0.49", since this gives you links to all the documentation for a distribution, not just that in the main module. This applies to all CPAN modules, not just CGI::Wiki.
Kake