Torsten Raudssus


SyForm - A role driven, readonly attributes, form management


version 0.008


  use SyForm;

  my $form = SyForm->create([
    'username' => {
      required => 1,
      label => 'Your name',
    'age' => {
      decimal => 1,
      label => 'Your age',
    'unchecked' => {
      label => 'Unchecked',

  $form->does('SyForm'); # its all roles

  # Roles are only automatically loaded on requirement

  my $view = $form->process( username => 'YoCoolCopKiller', age => 13 );

  # or ...
  # $values = $form->process_values(%args);
  # my $value = $values->value;
  # !$values->can('success'); # values are only the input
  # $results = $form->process_results(%args);
  # my $result = $results->get_result('username');
  # my $value = $results->values->get_value('username');
  # my $success = $result->success # result is after check

  for my $field_name (@{$view->field_names}) {
    my $input_value = $view->field($field_name)->value;
    if ($view->success) {
      my $verified_result = $view->field($field_name)->result;  
    } else {
      # result is filled for all valid fields, even on invalid form
      my $verified_result_if_exist = $view->field($field_name)->result;
    # for access to the main SyForm::Field of the view field
    my $syform_field = $view->field($field_name)->field;


SyForm is developed for SyContent.

SyForm has many SyForm::Field. You get a form object with calling create([@fields], %form_args) on SyForm.

With SyForm::Process (automatically added) you can give it process_args via calling of process(%args) on your form object that you get from the create.

This call to process creates internally a SyForm::Values out of the process args together with the help of the fields. Those again use this to produce a SyForm::Results with the final results of the process.

Those end up in a SyForm::View together with a SyForm::ViewField for every SyForm::Field that is used in the process flow. The view field allows easy access to the SyForm::Values values, the SyForm::Results results and the actually SyForm::Field definition, to get a complete access of all variables in the rendering.

For validation SyForm implements Validation::Class and so most of the directives available there are available in SyForm. A complete list can be found at SyForm::Field::Verify.



  Join #sycontent on Highlight Getty for fast reaction :).

  Pull request and additional contributors are welcome

Issue Tracker


Torsten Raudssus <>


This software is copyright (c) 2014 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.