Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trm() warning #233

Merged
merged 9 commits into from
Aug 6, 2024
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- warn if trm() is called with undefined arguments

0.49.6 2024-07-17 17:25:39 +0200 Tobias Oetiker <tobi@oetiker.ch>

- fix some more memory loops
Expand Down
10 changes: 8 additions & 2 deletions lib/CallBackery/Translate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,14 @@ use overload
};

sub trm ($str,@args) {
# make sure the arguments are stringified
return bless [$str,map { "$_" } @args];
# make sure the arguments are stringified, warn if undefined
return bless [$str,map {
if (not defined $_) {
my ($package, $filename, $line) = caller;
warn "Undefined argument for str='$str' from $package line $line";
}
"$_"
} @args];
}

=head2 $str->TO_JSON
Expand Down
Loading