perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Faust" <>
Subject Coding Style Question - Using exit
Date Tue, 19 Aug 2003 00:07:30 GMT

In the continuing effort to make my code better, I'm trying to get rid "exit" in my scripts
and clean up some things that just don't sit well (but they work).

Almost 95% of my pages are served up via a template system (H::T) and the rest are a redirects.
Currently I use a subroutine that all my other subs pass content to, to display my templates
- at the end of this sub I call "exit" so I do not go any further.
In the case where I want to redirect to a URL, I then "return" to the handler with the URL.

Although it works, it doesn't seem right to me..

Example To Help Explain:

sub handler {
 $r = shift;


$back_url = determine_proper_action();

my $back_url = "";
$r->headers_out->set(Location => $back_url);
return Apache::REDIRECT;

"Determine proper action" is a dispatch list of all the subroutines that make up the script,
including the sub where I display the templates and exit.
So for almost 95% of my requests, I'm "exiting" within determine_proper_action().

Does that make sense? Is it a bad thing?


View raw message