| Form-Sensible documentation | Contained in the Form-Sensible distribution. |
Form::Sensible::Renderer - Base class for Renderers.
This module provides a base class for renderers. It's not very interesting.
render($form)Returns a rendered representation of the form.
render_hints_for($renderer_name, $thing)Returns the render hints for the given type. This looks for an element called
renderer_name in $thing->render_hints. If found, it is returned,
otherwise returns $thing->render_hints. This is used to allow for
specification of different renderhints within the same form for use by
different renderers.
Jay Kuri - <jayk@cpan.org>
Ionzero LLC. http://ionzero.com/
Copyright 2009 by Jay Kuri <jayk@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Form-Sensible documentation | Contained in the Form-Sensible distribution. |
package Form::Sensible::Renderer; use Moose; use namespace::autoclean; ## this module provides the basics for rendering of forms / fields ## ## should this be an abstract role that defines the interface for rendering? sub render_hints_for { my ($self, $renderer_name, $thing) = @_; my $hints = $thing->render_hints(); if (exists($hints->{$renderer_name})) { return $hints->{$renderer_name}; } else { return $hints; } } sub render { my ($self, $form) = @_; die "Unable to render " . $form->name . " because you are trying to use an abstract base class to render."; } __PACKAGE__->meta->make_immutable; 1; __END__