package AHP::FakeTemplate; =head1 DESCRIPTION Tames CGI::FormBuilder. The class pretends to be a Template in order to catch the CGI::FormBuilder vars passed to process so that we can use them outside of the callback. =head1 SYNPOSIS my $fb_vars; my $form = CGI::FormBuilder->new( ... template => { engine => AHP::FakeTemplate->new_fake(\$fb_vars), type => 'TT2', template => 'ignored', }, ); $form->render(); ... $template->process('my.tt2', { form => $fb_vars, ... }); my.tt2: [% form.start %] [% FOREACH f = form.fields %] [%# "
"; Dumper.dump(f) | html ; "" %] [% f.required ? "$f.label" : f.label %] [% f.field %] [% f.comment %]