diff --git a/lib/Form/Tiny/Error.pm b/lib/Form/Tiny/Error.pm index 96b7d90..e7be2b0 100644 --- a/lib/Form/Tiny/Error.pm +++ b/lib/Form/Tiny/Error.pm @@ -140,7 +140,7 @@ Form::Tiny::Error - form error wrapper ); my $field = $error->field; # field name or undef - my $data = $error->error; # error message or nested error object + my $data = $error->get_error; # error message or nested error object # concatenated error message: "$field - $data" my $message = $error->as_string; @@ -153,7 +153,7 @@ Form::Tiny::Error - form error wrapper The form errors class features field name which caused validation error, error message and automatic stringification. -The C<< $error->error >> can return a nested error object in case of nested +The C<< $error->get_error >> can return a nested error object in case of nested forms. A couple of in-place subclasses are provided to differentiate the type of error diff --git a/lib/Form/Tiny/Manual/Internals.pod b/lib/Form/Tiny/Manual/Internals.pod index af9d289..5dd4fc3 100644 --- a/lib/Form/Tiny/Manual/Internals.pod +++ b/lib/Form/Tiny/Manual/Internals.pod @@ -115,10 +115,23 @@ It is entirely possible, although a bit tedious, to use the module without importing L package. The following example declares a form with a single field taken from the example above. -The code present in C example should result in a form that has -the same capabilities as the one below: +These two packages should result in a form with the same capabilities. - package MyForm; + package MyForm1; + + use Moo; + use Form::Tiny::Utils qw(:meta_handlers); + + my $meta = create_form_meta(__PACKAGE__, qw()) + ->set_form_roles(['Form::Tiny::Form']); + + __PACKAGE__->form_meta->add_field( + 'field-name' => ( + required => 1, + ) + ); + + package MyForm2; use Form::Tiny; @@ -126,11 +139,10 @@ the same capabilities as the one below: required => 1, ); - 1; - -B building your form like this should be done only for educational -purposes. Changes in import procedure are not covered by the 3 month -deprecation period policy. +B trying to build your form from scratch to match exactly what +Form::Tiny importer is doing should only be done for educational purposes. +Changes in import procedure are not covered by the 3 month deprecation period +policy. =head1 SEE ALSO