I would look as follows with a die statement:
do { local *STDERR = *STDOUT; $! = 0; die(h1( {class=>'cyan'}, "Error occured $row->{username}! Script ha +ve to die" )); } if $select->rows;
Of course, the following would be shorter:
do { print(h1( {class=>'cyan'}, "Error occured $row->{username}! Script +have to die" )); exit(0); } if $select->rows;
Even shorter:
print(h1( {class=>'cyan'}, "Error occured $row->{username}! Script hav +e to die" )), exit(0) if $select->rows;
The problem is neither is particularly readable. You might as well use
if ($select->rows) { print(h1( {class=>'cyan'}, "Error occured $row->{username}! Script +have to die" )); exit(0); }
There is a readable one-line, however:
sub fatal_error { print(h1( {class=>'cyan'}, @_); exit(0); } fatal_error("Error occured $row->{username}! Script have to die") if $select->rows;
In reply to Re: Merge 2 lines in 1 die statement
by ikegami
in thread Die statement with text & formatting of the user
by Nik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |