Plugin(3pm)
π Class::DBI::Plugin π
okay bestie, listen up β this is Plugin(3pm), a User Contributed Perl Documentation page, and it's genuinely so cute. it's the abstract base class for Class::DBI plugins. slay.
β¨ NAME β¨
Class::DBI::Plugin β the abstract base class for Class::DBI plugins. that's the whole vibe. periodt.
πΈ SYNOPSIS πΈ
okay so here's what it actually looks like when you use it, copy-paste this energy:
use base 'Class::DBI::Plugin';
sub init {
my $class = shift;
$class->set_sql( statement_name => ... );
$class->add_trigger( ... );
$class->columns( TEMP => ... );
}
sub method_name : Plugged {
my $class = shift;
$class->sql_statement_name( ... );
}
sub this_method_is_not_exported {}
see how method_name has that : Plugged attribute? yeah. that's the whole trick. iykyk. π
π¦ DESCRIPTION π¦
so Class::DBI::Plugin is an abstract base class for Class::DBI plugins, and its whole purpose is literally just to make writing plugins easier. like, plugin writers should get to focus on the actual functionality their module provides instead of dealing with symbol table hackery β because ngl, symbol table hackery when you're writing a plugin module is so not the moment. π
only three things you gotta remember, bestie. three. that's it:
- every method that's meant to be exported gets the
"Plugged"attribute. every other method? not exported to the plugged-in class. simple as that. - method calls that need to go to the plugged-in class live inside the
init()method. examples of these includeset_sql(),add_trigger(), and so on. so many and so on. - the class parameter for the
init()method and for the"Plugged"methods is the plugged-in class, not the plugin class. this one is important, don't get it twisted. π
π CAVEATS π
okay so real talk, and this is the part where we hold hands π«Ά:
so far this module only "sees" methods in the plugin module itself. if there's a class sitting between the base class and the plugin class in the inheritance hierarchy, methods of that class will not be found. in other words: inherited methods will not be found. if requested, the author will implement this behaviour.
so likeβ¦ it just doesn't see them. that's the tea. π
π TODO π
it might be useful for plugin users to be able to choose only the plugin methods they're actually interested in, if there's more than one of them. this is not implemented yet. so don't come for it. π
π SEE ALSO π
Class::DBI
π AUTHOR π
Jean-Christophe Zeus, <mail@jczeus.com> β with some help from Simon Cozens. many thanks to Mark Addison for the idea with the init() method, and many thanks to Steven Quinney for the idea with the subroutine attributes. icons supporting icons, we love to see it. π
π COPYRIGHT AND LICENSE π
Copyright (C) 2004 by Jean-Christophe Zeus
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page bestie!! β¨ this is Plugin(3pm) from perl v5.32.0, dated 2021-01-06 β mwah, iconic, no notes, go write a plugin ππ¦π
π¦ where this page comes from
- debian bookworm: libclass-dbi-plugin-perl 0.03-6.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libclass-dbi-plugin-perl 0.03-6.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libclass-dbi-plugin-perl 0.03-6.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libclass-dbi-plugin-perl 0.03-6.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libclass-dbi-plugin-perl 0.03-6.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libclass-dbi-plugin-perl 0.03-6.1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms