Wiki::...:Plugin(3pm)
π NAME π
Wiki::Toolkit::Plugin β a base class for Wiki::Toolkit plugins. This is the Wiki::Toolkit::Plugin(3pm) page from the User Contributed Perl Documentation, bestie π.
π¦ DESCRIPTION π¦
okay so this base class gives you methods for accessing the backend store, search, and formatter objects of the Wiki::Toolkit object that a plugin instance is registered with. That's the whole vibe β¨.
πΈ SYNOPSIS πΈ
package Wiki::Toolkit::Plugin::Foo;
use base qw( Wiki::Toolkit::Plugin);
# And then in your script:
my $wiki = Wiki::Toolkit->new( ... );
my $plugin = Wiki::Toolkit::Plugin::Foo->new;
$wiki->register_plugin( plugin => $plugin );
my $node = $plugin->datastore->retrieve_node( "Home" );
π POSSIBLE METHODS π
These are the methods a plugin can have, and here's what each one is giving:
β¨ pre_moderate β¨
Called before moderation is performed. Allows changes to the parameters used in moderation.
my %args = @_;
my ($name_ref,$version_ref) = @args{ qw( node version ) };
$$name_ref =~ s/\s/_/g;
return 0;
β¨ post_moderate β¨
Called after moderation has been performed. Allows additional actions to occur after node moderation.
my %args = @_;
my ($node,$node_id,$version) =
@args{ qw( node node_id version ) };
&update_pending_list($node,$version);
β¨ pre_rename β¨
Called before a rename is performed. Allows changes to the parameters used by rename.
my %args = @_;
my ($old_name_ref,$new_name_ref,$create_new_versions_ref) =
@args{ qw( old_name new_name create_new_versions ) };
$$old_name_ref =~ s/\s/_/g;
$$new_name_ref =~ s/\s/_/g;
return 0;
β¨ post_rename β¨
Called after a rename has been performed. Allows additional actions to occur after node renames.
my %args = @_;
my ($old_name,$new_name,$node_id) =
@args{ qw( old_name new_name node_id ) };
&recalculate_category_listings();
β¨ pre_retrieve β¨
Called before a retrieve is performed. Allows changes to the parameters used by retrieve.
my %args = @_;
my ($name_ref,$version_ref) = @args{ qw( node version ) };
return &check_retrive_allowed($$name_ref);
TODO: Allow declining of the read.
β¨ pre_write β¨
Called before a write is performed. Allows changes to the parameters used by the write;
my %args = @_;
my ($node_ref,$content_ref,$metadata_ref) =
@args{ qw( node content metadata ) };
$$content_ref =~ s/\bpub\b/Pub/g;
return 1;
β¨ post_write β¨
Called after a write has been performed. Allows additional actions to occur after node writes.
my %args = @_;
my ($node,$node_id,$version,$content,$metadata) =
@args{ qw( node node_id version content metadata ) };
&log_node_write($node,gmtime);
β¨ post_delete β¨
Called after a delete has been performed. Allows additional actions to occur after node deletions.
my %args = @_;
my ($node,$node_id,$version) =
@args{ qw( node node_id version ) };
&log_node_delete($node,gmtime);
π DECLINING ACTIONS FROM PRE_ METHODS π
Note: This functionality is missing for pre_retrieve
It is possible for the pre_ methods (eg pre_write) to decline the action. This could be due to an authentication check done by the plugin, due to the content, or whatever else the plugin fancies. There are three possible return values from a pre_ plugin:
-1β Deny this action0orundefβ I have no opinion1β Allow this action
If you have only zeros, the action will be allowed. If you have ones and zeros, it will also be allowed.
If you have minus ones and zeros, it will be denied. If you have minus ones, ones and zeros, the sum will be used to decide.
For default deny, have one plugin return -1, and another only return 1 if the action is explicitly allowed.
π§ METHODS π§
π§ new π§
sub new {
my $class = shift;
my $self = bless {}, $class;
$self->_init if $self->can("_init");
return $self;
}
Generic constructor, just returns a blessed object.
π§ wiki π§
Returns the Wiki::Toolkit object, or undef if the register_plugin method hasn't been called on a Wiki::Toolkit object yet.
π§ datastore π§
Returns the backend store object, or undef if the register_plugin method hasn't been called on a Wiki::Toolkit object yet.
π§ indexer π§
Returns the backend search object, or undef if the register_plugin method hasn't been called on a Wiki::Toolkit object yet, or if the wiki object had no search object defined.
π§ formatter π§
Returns the backend formatter object, or undef if the register_plugin method hasn't been called on a Wiki::Toolkit object yet.
π SEE ALSO π
Wiki::Toolkit
π AUTHOR π
Kake Pugh (kake@earth.li).
π COPYRIGHT π
Copyright (C) 2003-4 Kake Pugh. All Rights Reserved.
Copyright (C) 2006 the Wiki::Toolkit team. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Source/version: perl v5.32.0; date: 2021-01-04 β that's the cute little footer sign-off, bestie, mwah ππ
π¦ where this page comes from
- debian bookworm: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms