Posted on 2005-02-09 11:40:10-08 by davebaird in response to 71
Re: getting started (cont)

The template root is the home of your application. So if the whole application is being handled by Maypole, then the template_root is the same as the document root. But if the Maypole application lives within a subdirectory of the website, then the template_root is the full path to that subdirectory. In your case, it'd be $DOCUMENT_ROOT/beerdb

The factory root is where Maypole looks if it doesn't find a template in the template_root, or a table-specific subdirectory. These are the templates that are provided in the distribution. I don't think they get installed anywhere during installation. You have to go into the build directory (somewhere in the .cpan directory) and fish them out and install them somewhere, say /usr/local/www/maypole. Or pull them out of the .tar.gz distribution file.

These undefined value errors look like you haven't inherited from MasonX::Maypole. Your BeerDB.pm needs to look a bit like this:

package BeerDB.pm; use strict; use warnings; use base 'MasonX::Maypole'; BeerDB->setup( ...db params... ); # then the various BeerDB->config calls as in the MasonX::Maypole synopsis, including BeerDB->config->{template_root} = "$DOCUMENT_ROOT/beerdb"; BeerDB->config->{uri_base} = '/beerdb'; BeerDB->config->masonx->{comp_root} = [ factory => '/usr/local/www/maypole' ]; # etc.

Now you can drop your own templates into $DOCUMENT_ROOT/beerdb, and they'll override those in /usr/local/www/maypole. And you can drop table-specific templates in $DOCUMENT_ROOT/beerdb/$table_moniker, and they'll override those in $DOCUMENT_ROOT/beerdb

d.

Direct Responses: 83 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.