=head1 CONSTRUCTOR
+=head2 new
+
The constructor is called C<new>, and accepts a optional hash of options.
Valid options are:
=head2 default_value
-Leave the attribute out all together to use the default in L<Schema::Field>.
-Use empty quotes or 'EMPTY_STRING' for a zero length string. 'NULL' for an
-explicit null (currently sets default_value to undef in the
-Schema::Field obj).
+Leave the attribute out all together to use the default in
+L<SQL::Translator::Schema::Field>. Use empty quotes or 'EMPTY_STRING'
+for a zero length string. 'NULL' for an explicit null (currently sets
+default_value to undef in the field object).
<sqlf:field default_value="" /> <!-- Empty string -->
<sqlf:field default_value="EMPTY_STRING" /> <!-- Empty string -->
=item * output_type (DEFAULT: 'png')
This determines which
-L<output method|GraphViz/as_canon,_as_text,_as_gif_etc._methods>
+L<output method|GraphViz/as_canon, as_text, as_gif etc. methods>
will be invoked to generate the graph: C<png> translates to
C<as_png>, C<ps> to C<as_ps> and so on.
# Convert produce call into an object method call
sub produce { return __PACKAGE__->new( translator => shift )->run; };
-See L<PRODUCER OBJECT> below for details.
+See L</PRODUCER OBJECT> below for details.
The upshot of this is we can make new template producers by sub classing this
base class, adding the above snippet and a template.
The module also provides a number of hooks into the templating process,
-see L<SUB CLASS HOOKS> for details.
+see L</SUB CLASS HOOKS> for details.
-See the L<SYNOPSIS> above for an example of creating a simple producer using
+See the L</SYNOPSIS> above for an example of creating a simple producer using
a single template stored in the producers DATA section.
=head1 SUB CLASS HOOKS
sub tt_vars { ( foo => "bar" ); }
Return hash of template vars to use in the template. Nothing added here
-by default, but see L<tt_default_vars> for the variables you get for free.
+by default, but see L</tt_default_vars> for the variables you get for free.
=head2 tt_default_vars
Return a hash-ref of the default vars given to the template.
You wouldn't normally over-ride this, just inherit the default implementation,
-to get the C<translator> & C<schema> variables, then over-ride L<tt_vars> to add
+to get the C<translator> & C<schema> variables, then over-ride L</tt_vars> to add
your own.
The current default variables are:
- Pass in template vars from the producer args and command line.
-- Merge in TT::Table.
+- Merge in L<TT::Table|SQL::Translator::Producer::TT::Table>.
- Hooks to pre-process the schema and post-process the output.
It needs one additional producer_arg of C<tt_table> which is the file
name of the template to use. This template will be passed a template
var of C<table>, which is the current
-L<SQL::Translator::Producer::Table> table we are producing, which you
-can then use to walk the schema via the methods documented in that
-module. You also get L<schema> as a shortcut to the
-L<SQL::Translator::Producer::Schema> for the table and C<translator>,
+L<SQL::Translator::Schema::Table> table we are producing,
+which you can then use to walk the schema via the methods documented
+in that module. You also get C<schema> as a shortcut to the
+L<SQL::Translator::Schema> for the table and C<translator>,
the L<SQL::Translator> object for this parse in case you want to get
access to any of the options etc set here.
- Better hooks for filename generation.
-- Integrate with L<TT::Base> and L<TTSchema>.
+- Integrate with L<TT::Base|SQL::Translator::Producer::TT::Base> and
+ L<TTSchema|SQL::Translator::Producer::TTSchema>.
=head1 SEE ALSO
The fields are returned as Field objects if they exist or as plain
names if not. (If you just want the names and want to avoid the Field's overload
-magic use L<field_names>).
+magic use L</field_names>).
Returns undef or an empty list if the constraint has no fields set.
=head2 carp_ro
Takes a field name and returns a reference to a function can be used
-L<around|Moo/around> a read-only accessor to make it L<carp|Carp/carp>
+L<around|Moo/around> a read-only accessor to make it L<carp|Carp>
instead of die when passed an argument.
=head2 batch_alter_table_statements
Takes diff and argument hashes as passed to
-L<batch_alter_table|SQL::Translator::Diff/batch_alter_table($table, $hash) (optional)>
+L<batch_alter_table|SQL::Translator::Diff/batch_alter_table($table, $hash, $args) (optional)>
and an optional list of producer functions to call on the calling package.
Returns the list of statements returned by the producer functions.