Ok, so I've got Maypole up and running, and the default factory templates seem to be working great for listing/searching/viewing/editing any item from any of my tables (the main two being "authors" and "pubs"). Next I tried introducing relationships, using Class::DBI::Loader::Relationship...

IsfdbMaypole->config->{loader}->relationship($_) for ( "an author has a note", "a pub has a note", );

...the relationships seem to be generating fine, the ./authors/view and ./pubs/view pages work perfectly, and the value in the note row (if there is one) links to the corrisponding ./notes/view page. Sweet.

The problem I'm having is with the ./authors/list and ./pubs/list (and ./authors/search and ./pubs/search) pages. if the "an author has a note" relationship is defined, then ./authors/list and ./authors/search both generate the following error message in my logs...

plugin error - Class: plugin not found at /home/hossman/.perllib/lib/p +erl5/site_perl/5.8.5/Maypole.pm line 123

...and the page renders as....

Template not found

This template was not found while processing the following request: list on table authors with objects:

...list of authors it wants to display...

Looking for template list in paths:

/home/hossman/public_html/isfdb-maypole/
/home/hossman/public_html/isfdb-maypole/authors
/home/hossman/public_html/isfdb-maypole/custom
/home/hossman/public_html/isfdb-maypole/factory

If I comment the relaionship out, the list page works perfectly again. The exact same thing happens with ./pubs/list and "a pub has a note"

I'm not very familiar with Template::Toolkit, but I suspect the "Template not found" is just a red herring message that shows up because the template is failing to render itself. The key questions are: What does the error in the log mean? and: why doesn't the list template render itself properly?

Here's the tables I'm using...

mysql> describe pubs; +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | pubid | int(11) | | PRI | NULL | auto_increment | | title | mediumtext | YES | | NULL | | | author | mediumtext | YES | | NULL | | | tag | varchar(32) | YES | | NULL | | | year | date | YES | | NULL | | | publisher | varchar(64) | YES | | NULL | | | pages | varchar(16) | YES | | NULL | | | ptype | varchar(8) | YES | | NULL | | | ctype | varchar(8) | YES | | NULL | | | isbn | varchar(16) | YES | | NULL | | | isbn2 | varchar(16) | YES | | NULL | | | coverart | mediumtext | YES | | NULL | | | bcoverart | mediumtext | YES | | NULL | | | frontimage | mediumtext | YES | | NULL | | | price | varchar(16) | YES | | NULL | | | note | int(11) | YES | | NULL | | +------------+-------------+------+-----+---------+----------------+ 16 rows in set (0.00 sec) mysql> describe authors; +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | pubid | int(11) | | PRI | NULL | auto_increment | | canonical | mediumtext | YES | | NULL | | | legalname | mediumtext | YES | | NULL | | | birthplace | varchar(64) | YES | | NULL | | | birthdate | date | YES | | NULL | | | deathdate | date | YES | | NULL | | | pseudos | mediumtext | YES | | NULL | | | emails | mediumtext | YES | | NULL | | | webpages | mediumtext | YES | | NULL | | | note | int(11) | YES | | NULL | | +------------+-------------+------+-----+---------+----------------+ 10 rows in set (0.00 sec) mysql> describe notes -> ; +-------+------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+------------+------+-----+---------+----------------+ | pubid | int(11) | | PRI | NULL | auto_increment | | note | mediumtext | YES | | NULL | | +-------+------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec)

(NOTE: all of the tables have the same primary key "pubid", but it's just an autogenerated int -- it isn't specific to the "pubs" table. Don't blame me, I didn't make the schema)

And here's my Maypole class...

package IsfdbMaypole; use strict; use warnings; use lib qw(/home/hossman/.perllib/lib/perl5/site_perl); use base 'CGI::Maypole'; use Class::DBI::Loader::Relationship; sub debug {1}; IsfdbMaypole->config->uri_base("http://XXXXXXXXXX/index.cgi/"); IsfdbMaypole->config->template_root("/home/hossman/public_html/isfdb-m +aypole/"); IsfdbMaypole->config->application_name("ISFDB Tool (Maypole Prototype) +"); IsfdbMaypole->config->rows_per_page(10); IsfdbMaypole->config->user("hossman"); IsfdbMaypole->config->pass("XXXXXXXXXXXXXXXXXXXXXX"); IsfdbMaypole->setup("dbi:mysql:hossman"); IsfdbMaypole->config->{loader}->relationship($_) for ( # leaving these lines as is causes ./author/list to break, # but ./author/view links to ./notes/view # ./pubs/list on the other hand works fine, but ./pubs/view # doesn't link to ./notes/view "an author has a note", # "a pub has a note", ); 1;

Final note regarding my installation:

When I first got Maypole up and running, I encountered some errors that lead me to realize that Maypole wasn't finding the "factory" templates that it was supposed to use as defaults. They hadn't been installed anywhere on my machine, just left in "~/.cpan/build/Maypole-2.06/templates/factory/. I'm still not sure if they were supposed to get installed somewhere and didn't because I installed Maypole into my private perl lib, or if I was supposed to manually copy them somewhere (none of the docs I've seen suggest that users need to manually copy the factory templates, but I also couldn't find anything in the code that suggested that Maypole would be looking for them anywhere other then the current working directory. So I copied them, set my "template_root", and things started working. I mention this because if it was an installation problem, then perhaps soemthing else went wrong with the instalation as well.


In reply to Maypole: "has a" causes plugin failure using factory/list by hossman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.