I recently found it convenient to generate a pile of templated functions. I'd like to also generate the pod for this. I don't know of any obvious way to get this. I included two samples that describe what I'd like to have "just work." Neither do. The first fails because the pod is just ignored by the eval and perldoc never sees it either. The latter fails because perldoc ignores .pmc files.
Any ideas on how to get this to work?
Non-working idea #1:
BEGIN { for my $nm (qw( io fm cv hv pvlv gv av bm pvmg pvnv pviv rv nv iv +pv sv )) { eval <<"B_SUGAR"; =item \L$nm\E( OBJ ) Returns a boolean indicating whether OBJ is an instance of type B::\U$ +nm\E. This respects any overridden ->isa methods. =cut sub \L$nm\E { my \$op = shift \@_; return blessed(\$op) and \$op->isa('B::\U$nm\E'); } B_SUGAR if ( my $e = $@ ) { die $e; } push @EXPORT_OK, $nm; } }
Non-working idea #2
use tt ( subs => [qw( io fm cv hv pvlv gv av bm pvmg pvnv pviv rv nv i +v pv sv )] ); [% FOREACH sub IN subs %] =item [% sub %]( OBJ ) Returns a boolean indicating whether OBJ is an instance of type B::[% +sub %]. This respects any overridden ->isa methods. =cut sub [% sub %] { my $op = shift @_; return blessed($op) and $op->isa('B::[% sub %]'); } [% END %] no tt;
( The above was originally just one example with some questionable indentation. It was changed to the current form within a few minutes.)
In reply to Templating pod generation? by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |