What's the right way to do this here newfangled "function template"? I'm subclassing HTML::Filter and overriding all the methods in an identical fashion. Here's the relevant code:

#!/usr/bin/perl sub fillTemplate { my $funcName = shift; my $index = shift; sub { my $self = shift; sanityCheck($self); ($self->{inTheComment} == 1) ? push @{$self->{killBuffer}}, $_[$index] : $self->SUPER::$funcName(@_); } } for $function ( [ 'declaration', 0 ], [ 'start', 3 ], [ 'text', 0 ], [ 'end', 1 ] ) { *($function->[0]) = fillTemplate($function->[0],$function->[1]); + }

Perl doesn't like me referring to $self->SUPER::$funcName. What's the proper way? Dispensing with the template and writing it all out, the line reads $self->SUPER::start, $self->SUPER::end, etc.


In reply to Function templates done right by drix

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.