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

sub __x_err { my $msg = shift; __x("$msg: {err}", err => $!, @_); };
, so a simple regular expression won't help too much.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.