The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CTK::Plugin - Base class for CTK plugins writing

VERSION

Version 1.01

SYNOPSIS

package CTK::Plugin::Foo;
use strict;
use base qw/CTK::Plugin/;

sub init {
    my $self = shift; # It is CTK object!
    ...
    return 1; # or 0 if errors
}

__PACKAGE__->register_method(
    namespace => "CTK", # Optional. Default: CTK
    method    => "foo",
    callback  => sub {
        my $self = shift; # It is CTK object!
        ...
        return 1;
});

1;

DESCRIPTION

A "plugin" for the CTK is simply a Perl module which exists in a known package location (CTK::Plugin::*) and conforms to a our standard, allowing it to be loaded and used automatically. See CTK::Plugin::Test for example

init

Allows you to initialize your plugin

The method is automatically call in CTK constructor. The first param is CTK object. The method MUST return 0 in case of failure or 1 in case of successful initialization

register_method

__PACKAGE__->register_method(
    namespace => "CTK", # Optional. Default: CTK
    method    => "mothod_name",
    callback  => sub {
        my $self = shift; # It is CTK object!
        ...
        return 1;
});

Allows register the method that will be linked with Your plugin callback function

HISTORY

1.00 Wed 1 May 00:20:20 MSK 2019

Init version

See Changes file

TO DO

See TODO file

BUGS

* none noted

SEE ALSO

CTK::Plugin::Test

AUTHOR

Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2022 D&D Corporation. All Rights Reserved

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See LICENSE file and https://dev.perl.org/licenses/