Here's the synopsis:
SYNOPSIS # Wrap all subs in default code to warn on entry/exit, displaying +args and return values... use Devel::WrapExports; # The same thing, but ignore the specified packages and subs... use Devel::WrapExports exempt_pkgs => [ qw( Devel Carp CGI ) ], exempt_subs => [ qw( Nevermind::me ) ]; # Use my own subs for tracing instead of the defaults... use Devel::WrapExports pre => q{ sub { "custom pre-wrapper..." } }, post => q{ sub { "custom post-wrapper..." } }; # Run as script to list fully-qualified names of each symbol (sub +or otherwise) in the top-level scope... $ perl /path/to/Devel/WrapExports.pm <perl-source-file>
Some more background:

Initially, I only wanted to know where to go to find the source of hundreds of imported subs in code that I was looking at. Then, I realized that if I could automatically wrap all imported subs with warnings on entry/exit, I could get a nice trace in Apache error logs.

Currently, the technique is to look at all packages that are explicitly 'use'd or 'require'd by the caller (these are found by examining the caller's source code), then find all symbols that each of those packages export (this is done by looking at the contents of @EXPORT and @EXPORT_OK in each of these packages' symbol tables, so it's not compatible with non-Exporter.pm exporters). For each such symbol that is a sub, exploit Hook::LexWrap to wrap the sub (the one already imported into the caller's package) with "tracing code" as implied in the SYNOPSIS above (e.g. default or custom tracing subs).

Your question about handling non-Exporter.pm exporters is a good one. I hadn't considered that in my focused mindset. I plan on adding that support. It will be a matter of looking at the caller's symbol table instead of the caller's source (which is almost certainly a better approach anyhow).

So, in summary:

In reply to Re^2: [RFC: Module proposal] Tracing sneaky EXPORTs using wrappers by krazyk
in thread [RFC: Module proposal] Tracing sneaky EXPORTs using wrappers by krazyk

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.