[cgi-wiki-dev] SQLite Backend

Kate L Pugh cgi-wiki-dev@earth.li
Tue, 18 Nov 2003 10:07:33 +0000

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:

> 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.