Commit 10cb4b6
Fix Try::Tiny::catch when called as method via namespace pollution (#354)
When namespace::autoclean doesn't clean up Try::Tiny imports (as in
PerlOnJava's stub), modules like DateTime retain 'catch' in their
namespace. This causes issues when indirect object syntax like
'catch { $dt->truncate(...) }' is parsed as '$dt->truncate(...)->catch()'.
The fix detects when catch() is incorrectly invoked as a method (first
argument is a blessed reference instead of CODE) and throws the expected
'Can't locate object method' error, making tests like DateTime's
t/48rt-115983.t pass.
Generated with [Devin](https://cli.devin.ai/docs)
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 82e7e04 commit 10cb4b6
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
0 commit comments