| 1574 | | # ----------------------------------------- |
| 1575 | | # Subs: override handlers for standard perl. |
| 1576 | | # ----------------------------------------- |
| 1577 | | |
| 1578 | | # ugly hack. please don't try this at home kids! |
| 1579 | | sub my_die { |
| 1580 | | my ($arg,@rest) = @_; |
| 1581 | | my ($pack,$file,$line,$sub) = caller(0); |
| 1582 | | |
| 1583 | | # check if we are in an eval() |
| 1584 | | if ($^S) { |
| 1585 | | printf " shepherd caught a die() within eval{} from file $file line $line\n"; |
| 1586 | | } else { |
| 1587 | | printf "\nDIE: line %d in file %s\n",$line,$file; |
| 1588 | | if ($arg) { |
| 1589 | | CORE::die($arg,@rest); |
| 1590 | | } else { |
| 1591 | | CORE::die(join("",@rest)); |
| 1592 | | } |
| 1593 | | } |
| 1594 | | } |
| 1595 | | |