sub new { # ... miscellany # Create our object! my $self = {}; bless($self, $class); ### SET UP DEFAULT VALUES ### # # We set them up here and not in the setup() because a subclass # which implements setup() still needs default values! $self->header_type('header'); $self->mode_param('rm'); $self->start_mode('start'); # ... remainder of constructor, # including init and setup calls } #### sub new { # ... miscellany # Call cgiapp_init() method, which may be implemented in the sub-class. # Pass all constructor args forward. This will allow flexible usage # down the line. $self->call_hook('init', @args); ### SET UP DEFAULT VALUES ### # # We set them up here and not in the setup() because a subclass # which implements setup() still needs default values! $self->header_type('header'); $self->mode_param('rm'); $self->start_mode('start') unless defined $self->start_mode; # Call setup() method, which should be implemented in the sub-class! $self->setup(); return $self; }