Hi Jim,
I don't see any mention of FormBuilder in this code, so that's why
it's not getting loaded.
To get the MasonX config to work, you just need to call setup()
*after* specifying all the config, not before. This is becoming more
important as more plugins are developed that depend on config data.
The Maypole docs should emphasize this more.
Also, you should use Maypole::Application to set up your driver,
FormBuilder uses several plugins and Mp::App helps slot these in
properly.
See further comments below.
On 11/4/05, Jim Mintha <[EMAIL PROTECTED]> wrote:
>
> I have my maypole application running and everything works fine.
> However I wanted to convert it to use formbuilder, however no matter
> what I try it won't work. Eventually I returned to the BeerDB (which
> still works) and tried to convert it to formbuilder - still no luck
> even though I'm basically using the same setup as in the
> Maypole::Formbuilder docs.
>
> I get:
>
> [Fri Nov 4 01:15:13 2005] [error] No comp_root specified and cannot
> determine DocumentRoot. Please provide comp_root explicitly.\nStack:\n
> [/usr/local/share/perl/5.8.4/MasonX/Maypole.pm:127]\n
> [/usr/local/share/perl/5.8.4/Maypole.pm:64]\n
> [/usr/local/share/perl/5.8.4/Maypole.pm:32]\n [/dev/null:0]\n
> [Fri Nov 4 01:15:13 2005] [error] No comp_root specified and cannot
> determine DocumentRoot. Please provide comp_root explicitly.\nStack:\n
> [/usr/local/share/perl/5.8.4/MasonX/Maypole.pm:127]\n
> [/usr/local/share/perl/5.8.4/Maypole.pm:64]\n
> [/usr/local/share/perl/5.8.4/Maypole.pm:32]\n [/dev/null:0]\n
>
> Is it possible I have missed some Formbuilder or Mason modules? Is
> there a list somewhere? I've tried various combinations of order,
> BEGIN statements, etc. but it doesn't seem to see config stuff that
> I have defined.
>
> Any help appreciated,
> Jim
>
>
> The code:
>
> package BeerDB;
> use warnings;
> use strict;
>
> use Class::DBI::Loader::Relationship;
>
> use MasonX::Maypole;
> use base 'MasonX::Maypole';
Instead of these 3 lines, you can say
use Maypole::Application qw( MasonX Relationship );
The effect is much the same (except you can now specify the
relationships as a config setting, see below).
But that still doesn't get you FormBuilder. You need something like
use Maypole::Application qw(
MasonX FormBuilder Relationship
LinkTools QuickTable Session
-Debug2
);
Make sure you have Maypole::Plugin::LinkTools, M::P::QuickTable, and
M::P::Session installed (I think the FormBuilder installation pulls in
the 1st 2 but not the 3rd).
>
> BeerDB->setup( 'dbi:mysql:database=BeerDB;host=gnowee',
> 'www-data',
> 'lotd2004',
> );
Don't make the setup() call at this point. Several of the plugins need
access to config data during the setup() call, but that data doesn't
exist yet.
>
> BeerDB->config->{view} = 'MasonX::Maypole::View';
> BeerDB->config->{template_root} = '/home/www/beerdb/www/htdocs';
> BeerDB->config->{uri_base} = '/';
> BeerDB->config->{rows_per_page} = 10;
> BeerDB->config->{display_tables} = [ qw( beer brewery pub style ) ];
> BeerDB->config->{application_name} = 'The Beer Database';
>
> BeerDB->config->masonx->{comp_root} = [ [ factory =>
> '/usr/local/www/maypole/factory' ] ];
> BeerDB->config->masonx->{data_dir} = '/home/www/beerdb/www/mdata/maypole';
> BeerDB->config->masonx->{in_package} = 'BeerDB::TestApp';
This all looks fine, except you need to specify the model for FB::
BeerFB->config->model( 'Maypole::FormBuilder::Model' );
>
> BeerDB::Brewery->untaint_columns( printable => [qw/name notes url/] );
>
> BeerDB::Style->untaint_columns( printable => [qw/name notes/] );
>
> BeerDB::Beer->untaint_columns(
> printable => [qw/abv name price notes/],
> integer => [qw/style brewery score/],
> date => [ qw/date/],
> );
>
You don't use untaint_columns for validation with
Maypole::FormBuilder. To start with, ignore validation, and FB will
set up a basic validation spec for you. Once things are working, look
at CDBI::FormBuilder to learn how to customise the validation spec.
> BeerDB->config->{loader}->relationship($_) for (
> "a brewery produces beers",
> "a style defines beers",
> "a pub has beers on handpumps");
>
If you use the Relationship plugin, you can put this in the config:
BeerDB->config->relationships(
[
"a brewery produces beers",
"a style defines beers",
"a pub has beers on handpumps"
] );
This is the point where you should call setup().
> And in apache conf:
>
> <VirtualHost *>
> ServerName beerdb.mynet.com
> DocumentRoot /home/www/beerdb/www/htdocs
>
> <Location />
> SetHandler perl-script
> PerlHandler +BeerDB
> </Location>
>
> <Location /css>
> SetHandler default-handler
> </Location>
> </VirtualHost>
Looks fine.
Hope this helps, let us know how you get on.
d.
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Maypole-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users