GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Class::Component::Plugin(3) User Contributed Perl Documentation Class::Component::Plugin(3)

Class::Component::Plugin - plugin base for pluggable component framework

Your plugins should succeed to Class::Component::Plugin by your name space, and use it.

    package MyClass::Plugin;
    use strict;
    use warnings;
    use base 'Class::Component::Plugin';
    1;

for instance, the init phase is rewritten.

    package MyClass::Plugin;
    use strict;
    use warnings;
    use base 'Class::Component::Plugin';
    __PACKAGE__->mk_accessors(qw/ base_config /);

    sub init {
        my($self, $c) = @_;
        $self->base_config($self->config);
        $self->config($self->config->{config});
    }
    1;


    package MyClass::Plugin::Hello;
    use strict;
    use warnings;
    use base 'MyClass::Plugin';
    sub hello :Method {
        my($self, $context, $args) = @_;
        'hello'
    }
    sub hello_hook :Hook('hello') {
        my($self, $context, $args) = @_;
        'hook hello'
    }

can use alias method name

    sub foo :Method('bar') {}

    $self->call('bar'); # call foo method

default hook name is method name if undefined Hook name

    sub defaulthook :Hook {}

    $self->run_hook( 'defaulthook' );

init
init phase your plugins
class_component_plugin_attribute_detect
class_component_plugin_attribute_detect_cache_enable
1 = using attribute detect cache 0 = not use cache
class_component_load_attribute_resolver
attribute name space detector

Method
register_method is automatically done.
Hook
register_hook is automatically done.

Kazuhiro Osawa <ko@yappo.ne.jp>

Class::Component

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2008-05-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.