is ( add_numbers(2, 2), 4);
is ( get_initials("John F. Kennedy"), "JFK");
####
sub show_record {
my $self = shift;
my $cgi = $self->query();
my $emp_no = $cgi->param("emp_no");
...
# code to access the database omitted
...
my $emp_rec = $sth->fetchrow_hashref;
...
# code to fiddle with the data omitted
...
my $template = $self->load_tmpl(emp_detail.tmpl.html');
$template->param( $emp_rec );
return $template->output;
}
##
##
sub show_record {
my $self = shift;
my $cgi = $self->query();
my $emp_no = $cgi->param("emp_no");
my $emp_rec = get_emp_data($emp_no);
my $template = $self->load_tmpl(emp_detail.tmpl.html');
$template->param( $emp_rec );
return $template->output;
}
sub get_emp_data {
my ($emp_no) = (@_);
...
# code to access the database omitted
...
my $emp_rec = $sth->fetchrow_hashref;
...
# code to fiddle with the data omitted
...
return $emp_rec;
}