DESCRIPTION

This module allows you to declare a policy for your Fey::ORM::Table-using classes.

A policy can define transform rules which can be applied to matching columns, as well as a naming scheme for has_one and has_many methods. This allows you to spare yourself some drudgery, and allows you to consolidate decisions (like "all date type columns return a DateTime object") in a single place.

FUNCTIONS

This module exports a bunch of sugar functions into your namespace so you can define your policy in a declarative manner:

transform_all

This should be followed by a matching sub reference, and one of an inflate or deflate sub.

matching { ... }

This function takes a subroutine reference that will be called and passed a Fey::Column object as its argument. This sub should look at the column and return true if the associated inflate/deflate should be applied to the column.

Note that the matching subs are checked in the order they are defined by transform_all(), and the first one wins.

inflate { ... }

An inflator sub for the associated transform. See Fey::ORM::Table for more details on transforms.

deflate { ... }

A deflator sub for the associated transform. See Fey::ORM::Table for more details on transforms.

has_one_namer { ... }

A subroutine reference which will be used to generate a name for has_one() methods when a name is not explicitly provided.

This sub will receive the foreign table as its first argument, and the associated FK object as the second argument. In most cases, the foreign table will probably be sufficient to generate a name.

has_many_namer { ... }

Just like the has_one_namer(), but is called for naming has_many() methods.

As a valued partner and proud supporter of MetaCPAN, StickerYou is
happy to offer a 10% discount on all Custom Stickers,
Business Labels, Roll Labels,
Vinyl Lettering or Custom Decals. StickerYou.com
is your one-stop shop to make your business stick.
Use code METACPAN10 at checkout to apply your discount.