in reply to Dollar Bracket Star ${*...}
The * on the LHS is like a wild card to match the "type" on the RHS. Another term related to this is monkey patching.# code not tested sub test_this { my $stuff = call_to_external_service(); return $stuff; } #... # subroutine mock for a unit test, e.g., { no warnings qw/redefine/; my $expected = { some => 'expected result'}; local *call_to_external_service = sub { return $expected, }; # now call a test or something that calls is_deeply test_this(), $expected, qw{whatever...}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dollar Bracket Star ${*...}
by cavac (Prior) on Jan 11, 2022 at 12:56 UTC | |
by choroba (Cardinal) on Jan 11, 2022 at 17:29 UTC | |
by cavac (Prior) on Jan 11, 2022 at 18:03 UTC |