NAME
Bigtop::Backend::Model - defines legal keywords in table and field blocks
SYNOPSIS
If you are making a Model generating backend:
use Bigtop::Backend::Model;
This specifies the valid keywords for the Model generating backend.
If you need additional keywords which are generally useful, add them here (and send in a patch). If you need backend specific keywords, register them within your backend module. Note that only keywords affecting the model should be put here. But, fields have other keywords which affect things like what SQL represents them and how they look in html forms. Register those keywords in Bigtop::SQL:: or Bigtop::Control:: modules.
DESCRIPTION
If you are using a Bigtop backend which generates models, you should read this document to find out what the valid keywords inside table and field blocks are.
If you are writing a Bigtop backend to generate models, you should use this module. That will register the standard table and field keywords with the Bigtop parser.
BASIC STRUCTURE
A bigtop app block could look like this:
app name {
table name {
field name {
}
}
}
TABLE KEYWORDS
Tables can be field blocks. They can also have these simple statements:
- foreign_display
-
Inside the table, you can include a foreign_display statement. The value must be a quoted string like this:
foreign_display `%last_name, %first_name`;
Any percent and the Perl identifier after it will be replaced with the current row's values for those columns. This is useful when a model needs to deliver a user meaningful value for the current row.
- model_base_class
-
This becomes the base class of the model module for this table. Each backend has a default base model, but setting this overrides it.
FIELD KEYWORDS
- non_essential
-
Inside the field you may include non_essential. If it has a true value, the column will not be considered essential. This usually means that it will not be fetched when a row is retrieved from the database, unless its accessor is directly called. By default, all fields are considered essential.
OTHER KEYWORDS
The main Bigtop::Parser registers not_for simple statements for tables and fields. You can use them like this:
table something_that_needs_no_model {
not_for Model;
...
}
This will generate the SQL for the table (if you are using an SQL backend), but not the Model. The same goes for this:
table normal_but_with_strange_field {
field confusing_to_CDBI {
is int4;
not_for Model;
}
}
AUTHOR
Phil Crow <philcrow2000@yahoo.com>
COPYRIGHT and LICENSE
Copyright (C) 2005 by Phil Crow
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.