Use [php], [html] or [code] tags (as appropriate) to format code.
As we're not oracles, give us the exact error message ("internal server error" is a generic error from the Apache server and tells us nothing about what's wrong). To get the exact error, check the error log.
If you're not already doing so, do your development on your own server so you have more control. It makes it much easier to debug and your users can continue to use the public site without interruption.
You shouldn't use exit when outputting an HTML document, as it will be malformed. Instead, return a value indicating failure.
Code:
sub printWelcome {
my $sid = shift;
my $sessman = SessMan->new();
if ( ! $sessman->retrieveSession($sid)) {
print "Failed to retrieve existing session: ".$sessman->getError();
return 0;
}
print "<h2>Welcome ", $sessman->getUsername(), '</h2>';
return 1;
}

Originally Posted by
matthew9090
if i put the h2 tag at the getUsername() it comes up with an error.
How are you "putting the h2 tag at the getUsername()"? We can't answer questions about what's going wring without seeing the exact code. Is the sample code supposed to generate an error?