# # My intention for this package is to construct a set of modules that # will allow me to easily display a pre-"configured" CGI::FormBuilder # object. # # This outputs the surrounding html as well as some of the data # set in &new below (see comments). However, other vital parts, # such as generated javascript and form elements, are obviously broken. # # #
#
# # # MSI::Form::Signup=HASH(0x830c6f0) #
# # # MSI::Form::Signup=HASH(0x830c6f0) id Signup_firstname_label class # # ... # # package MSI::Form::Signup; use strict; use warnings; use CGI::Pretty qw/:standard/; use CGI::FormBuilder; our @ISA = qw/CGI::FormBuilder/; sub new { my $proto = shift; my $class = ref($proto) || $proto; my @fields = qw(firstname surname); # # The below works perfectly well when excluded from my package. # Clearly I need more perl practice.. # my $self = $class -> SUPER::new ( name => 'Signup', fields => \@fields, text => h2('Join the community!'), # this is outputted header => 0, validate => { firstname => 'NAME', surname => 'NAME' } ); # # This string is outputted as expected (or, rather, as I was hoping for). # $self -> fields( name => 'firstname', label => 'Please enter your first name'); # # I guess this is re-blessing, and a bad idea? # return bless $self, $class; } 1;