| 1 | # Test Carp::Heavy's "swap subs out from under you with goto &sub" | ||
| 2 | |||
| 3 | 16 | ▶ | use lib 't'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package Test18; | ||
| 6 | |||
| 7 | 16 | ▶ | sub longmess { goto &longmess_jmp } |
|
Subroutine
longmess: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 16 | ▶ | sub longmess_jmp { |
|
Subroutine
longmess_jmp: called CC=1 SCAR=0.0
| |||
| 10 | # the required file deletes this longmess_jmp sub, while it's executing, | ||
| 11 | # and replaces it with longmess_real, which we then goto into! | ||
| 12 | 16 | require 'test18-goto2.pm'; # has to be require, not eval '...' | |
| 13 | 16 | goto &longmess_real; | |
| 14 | } | ||
| 15 | |||
| 16 | 16 | longmess("Oops"); | |