=head1 NAME
Mojolicious::Plugin::DomIdHelper - Mojolicious plugin to generate DOM IDs from your ORM objects
=head1 SYNOPSIS
# Mojolicious
$self->plugin('dom_id_helper');
# Or, your defaults
$self->plugin('dom_id_helper', delimiter => '-')
# Mojolicious::Lite
plugin 'dom_id_helper';
# Set defaults
plugin 'dom_id_helper', delimiter => '-'
# Your view
...
...
=head1 DESCRIPTION
DOM IDs are generated by joining an object's package name and its primary key with the character specified by the
L option. It's assumed that the primary key can be retrieved via a method named C.
This can be modified, see L.
For example, given an instance of C with an ID of C<1>:
dom_id($user)
will generate:
user_1
If the primary key is undefined only the package name is returned.
Multi-column primary keys are not separated by the L option, they are concatenated.
=head1 ORMs
The aim is to be ORM agnostic. Just set the L option to the name of the method used to
retrieve your object's primary key.
Multi-column primary keys returned as array references will cause problems (for now).
=head1 OPTIONS
=head2 C
plugin 'dom_id_helper', delimiter => '-'
The character used to delimit the object's package name from its primary key. Defaults to C<'_'>.
=head2 C
plugin 'dom_id_helper', method => 'name'
plugin 'dom_id_helper', method => [qw{first_name last_name}]
The method used to retrieve the object's primary key. Defaults to C<'id'>.
=head2 C
plugin 'dom_id_helper', keep_namespace => 1
Keep the full package name when generating the DOM ID. Defaults to C<0> (false).
=head1 AUTHOR
Skye Shaw