| | 1588 | # ----------------------------------------- |
| | 1589 | # Subs: override handlers for standard perl. |
| | 1590 | # ----------------------------------------- |
| | 1591 | |
| | 1592 | # ugly hack. please don't try this at home kids! |
| | 1593 | sub my_die { |
| | 1594 | my ($arg,@rest) = @_; |
| | 1595 | my ($pack,$file,$line,$sub) = caller(0); |
| | 1596 | |
| | 1597 | # check if we are in an eval() |
| | 1598 | if ($^S) { |
| | 1599 | printf " shepherd caught a die() within eval{} from file $file line $line\n"; |
| | 1600 | } else { |
| | 1601 | printf "\nDIE: line %d in file %s\n",$line,$file; |
| | 1602 | if ($arg) { |
| | 1603 | CORE::die($arg,@rest); |
| | 1604 | } else { |
| | 1605 | CORE::die(join("",@rest)); |
| | 1606 | } |
| | 1607 | } |
| | 1608 | } |
| | 1609 | |