Changeset 39 in text-formbuilder for trunk/lib/Text/FormBuilder


Ignore:
Timestamp:
12/07/04 16:18:02 (20 years ago)
Author:
peter
Message:

added write_script function to write a complete CGI script using the form
abstracted some of the internal code generating and writing code to be easily reused by write_* functions
started work on allowing validation coderefs in the formspec

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Text/FormBuilder/grammar

    r29 r39  
    1111        %lists, 
    1212        %patterns, 
     13        %subs,         # validation subs 
    1314        @group,        # current group 
    1415        %groups,       # stored groups of fields 
     
    2425} 
    2526 
    26 form_spec: (list_def | description_def | group_def | line)(s) 
     27form_spec: (list_def | description_def | validate_def | group_def | line)(s) 
    2728    { 
    2829        # grab the last section, if there is any 
     
    4546            lists    => \%lists, 
    4647            patterns => \%patterns, 
     48            subs     => \%subs, 
    4749            groups   => \%groups, 
    4850            sections => \@sections, 
     
    7173    $description =~ s/^{\s*|\s*}$//g; 
    7274    } 
     75 
     76validate_def: '!validate' var_name <perl_codeblock> 
     77    { $subs{$item{var_name}} = $item[3] } 
    7378 
    7479group_def: '!group' { $context = 'group' } var_name '{' field_line(s) '}' { $context = 'line' } 
Note: See TracChangeset for help on using the changeset viewer.