On Sun, Jan 16, 2005 at 12:04:42PM -0600, Marcelo E. Magallon wrote:
> Sorry for making so much noise, I'm having fun dwelling thru Spoon
> and Kwiki code :-)
Sorry again...
> Is this kosher?
>
> $self->hub->formatter->table->{heading} = "My::Formatter::Heading";
>
> my concern is order of initialization...
Ok... as far as I can see, this workds:
package Kwiki::TableOfContents;
use Kwiki::Plugin -Base;
our $VERSION = "0.1";
const class_id => 'table_of_contents';
const class_title => 'Table of Contents';
sub register
{
my $registry = shift;
$registry->add(preload => 'table_of_contents');
$registry->add(wafl => toc => 'Kwiki::TableOfContents::Wafl');
}
sub init
{
super;
my $formatter = $self->hub->load_class('formatter');
$formatter->table->{heading} = 'Kwiki::TableOfContents::Heading';
}
what I didn't quite get is why I needed the preload thing. This was
trial and error after seeing it used in e.g. Kwiki::Icons.
The other thing I didn't get is why I need to use load_class at this
point.
Marcelo