Skip to content

Commit

Permalink
Documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrtj committed Sep 6, 2024
1 parent 7ced193 commit f644c06
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/Form/Tiny/Error.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
28 changes: 20 additions & 8 deletions lib/Form/Tiny/Manual/Internals.pod
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,34 @@ It is entirely possible, although a bit tedious, to use the module without
importing L<Form::Tiny> package. The following example declares a form with a
single field taken from the example above.

The code present in C<metaobject.pl> 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;

form_field 'field-name' => (
required => 1,
);

1;

B<Notice:> 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<Notice:> 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

Expand Down

0 comments on commit f644c06

Please sign in to comment.