I'm not sure I understand what you want correctly. Let me restate your problem and propose a solution - I think this solution is not a good solution but I think it would solve the problem as I perceive it:
I think your problem is that you have a printf-like function __x() and want to make sure that wherever you have a call to it all template names in the string are present in the additional parameter list. This is complicated by the fact that people could use @additional_args, or by helper subroutines like __x_err, which is
, so a simple regular expression won't help too much.sub __x_err { my $msg = shift; __x("$msg: {err}", err => $!, @_); };
I think one tedious solution would be to use Devel::Cover to map out all branches in your code that lead to a call of __x() and then to (manually) generate those parameter conditions that are missing from your test suite to make sure all those branches are actually reached.
I thought of writing a program that generates such conditions automatically, but so far I haven't felt the need - but maybe there is existing prior art. Hence my solution requires lots of manual work just to make sure your calling conventions are always followed. Using a regular expression to fish out all calls to __x() and then verifying that they all match a certain pattern might be saner, but there are always edge cases that might make this infeasible as well, unless you find that all your uses of __x() and __x_err() are simple uses (as they should maybe be, for a simple logging routine).
Now, did I understand your problem well enough to propose a (bad, tedious) solution or did I run off in the wrong direction alltogether? :)
In reply to Re: locating specific function calls
by Corion
in thread locating specific function calls
by markov
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |