sub foo { my $self = shift; $self->query->param('id'); if (!$id) {return $self->get_id();} #get_id returns a web page that prompts the user for an id #this is all running in mod_perl, with CGI::Application my $obj = $self->get_obj($id); #else do foo kinda stuff with $obj } #### sub foo { my $self = shift; my $obj = $self->init; #do foo kinda stuff with $obj } sub init { my $self = shift; $self->query->param('id'); if (!$id) {return $self->get_id();} my $obj = $self->get_obj($id); return($obj); }