Exploring mojomojo


My experience with Mojomojo. I'm documenting it here for what it's worth. The installation is on Fedora 4.

I am fluent in Perl, fairly new to Catalyst (one app in production), and have never admined a wiki before.

First of all I discovered after starting the install that this particular box had a stale CPAN mirror. That might be the reason that I had to manually install:

Test::Base String::Diff SQL::Translator

Perhaps I should have re-run Makefile.pl and make install once I fixed the mirror.

And, to clear a warning I installed shared-mime-info via yum. Not sure yet what this enables but it seems reasonable to have it anyhow.

Due to the stale mirror I also had to re-update Catalyst* and DBIx::Class.

I got an error running script/mojomojo_spawn_db.pl

Connecting to dbi:mysql:database=mojomojo
 as mojomojo
 with password
DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails at /usr/lib/perl5/site_perl/5.8.6/DBIx/Class/Storage/DBI.pm line 782.
DBIx::Class::Schema::populate(): Error executing 'INSERT INTO page_version (comments, content_version_first, content_version_last, created, creator, depth, name, name_orig, page, parent, parent_version, release_date, remove_date, status, version) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)': Cannot add or update a child row: a foreign key constraint fails at script/mojomojo_spawn_db.pl line 80

I've never done constraints so I'm on shakey ground here. Manual suggests running 'SHOW INNODB STATUS', whose relevant bit is:

------------------------
LATEST FOREIGN KEY ERROR
------------------------
070129 15:16:10 Transaction:
TRANSACTION 0 2566, ACTIVE 0 sec, process no 7571, OS thread id 2967788464 inserting, thread declared inside InnoDB 500
mysql tables in use 1, locked 1
5 lock struct(s), heap size 320, undo log entries 1
MySQL thread id 240, query id 3344 localhost mojomojo update
INSERT INTO page_version (comments, content_version_first, content_version_last, created, creator, depth, name, name_orig, page, parent, parent_version, release_date, remove_date, status, version) VALUES ('', '1', '1', '0', '2', '0', '/', '/', '1', NULL, NULL, '', '', '', '1')
Foreign key constraint fails for table `mojomojo/page_version`:
,
  CONSTRAINT `page_version_fk_page` FOREIGN KEY (`page`) REFERENCES `page` (`id`)
Trying to add in child table, in index `page` tuple:
DATA TUPLE: 2 fields;
 0: len 4; hex 80000001; asc     ;; 1: len 4; hex 80000001; asc     ;;

But in parent table `mojomojo/page`, in index `PRIMARY`,
the closest match we can find is record:
PHYSICAL RECORD: n_fields 1; 1-byte offs TRUE; info bits 0
 0: len 8; hex 696e66696d756d00; asc infimum ;;

I guess this simply means that the page already has to exist. Inserting the page first in the script fails because the content doesn't exist. Hmmm...

Oh, page allows null on its foreign keys. So I can create a blank page and then create the content, and then the page_version. But the spawn script isn't handling this properly. So I just let the script create the people and preferences, see if the app will test/run.

Well, the test seems to be looking for sqlite, so skip that for now. The app seems to run. I had to manually create all the entries in the proper order. Once I get more under the hood, I'll fix the script to make this work properly.