Re: Formatter.pm subclassing troubles

[email protected] (Kang-min Liu) Wed, 19 Apr 2006 10:02:00 +0800
Newsgroups perl.kwiki
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Apr 19, 2006, at 7:28 AM, FLoh Leeber wrote:

> sub formatter_classes {
> qw(
> Spoon::Formatter::WaflPhrase
> Spoon::Formatter::WaflBlock
> HSF::Formatter::UserID
> Heading Paragraph Preformatted Comment
> Strong Ulist Olist Item Table TableRow TableCell
> Line Emphasize Underline Delete Inline MDash NDash Asis
> HyperLink TitledHyperLink TitledMailLink MailLink
> ForcedLink TitledWikiLink WikiLink
> );
> }

Hi there,

Although you give 'HSF::Formatter::UserID' in here, but Kwiki::Formatter
these classes are prefixed with 'Kwiki::Formatter::', which is defined
earlier in the code by:

   const class_prefix => 'Kwiki::Formatter::';

That's the reason it's not working for you.

IMHO, for your purpose,instead of sub-classing everything,
you could just define a Kwiki::Formatter::UserID method and
use hook to change the return value of formatter_classes.

Cheers,
Kang-min Liu

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFERZoZCSIfi0PaMDQRAiu+AJ9tPeDyOldO7sbnalRkMoXHm39VcgCeMuJ3
xnsd4u27mAQmoW2uuN7YwJs=
=o0rF
-----END PGP SIGNATURE-----