in reply to Re: The -w switch on a web application
in thread The -w switch on a web application
If the sub routines return 0, nothing, or undef the second half of a line will be executed. Also when attempting to debug later, you can do a couple of things. Within the some_error_routine, you can watch for say a global $DEBUG, and depending on what the value of it is, you can determine what types of messages to send out to the log file, if debug isnt defined and you receive messages to be logged, you can still trim down your output, but you dont need to spend X amount of time adding debug statements to the rest of your code. You simply go to main, define 1 scalar, and then run the code again. Once your done with testing, you whack the scalar and everything goes back to normal.# # I split the code, but I dont think it would need to be on # a new line in an 80 char window # my $main_menu = new Menu("main") || &some_error_routine("Failed to create menu obj! $main_menu->err\ +n"); my $menu_item = param('menu_item') || &some_error_routine("No menu_item passed to cgi!"); my $active_menu_id = get_active_menu($menu_item) || &some_error_routine("Cant collect menu_id!!\n"); # # There should probably be a test here as well # $main_menu->active_menu_id($active_menu_id); $main_menu->output;
|
|---|