Tkx::MegaConfig(3)
π NAME π
Tkx::MegaConfig β handle configuration options for megawidgets. This is the Tkx::MegaConfig(3) page from the User Contributed Perl Documentation, bestie π
.
β¨ SYNOPSIS β¨
package Foo;
use base qw(Tkx::widget Tkx::MegaConfig);
__PACKAGE__->_Mega("foo");
__PACKAGE__->_Config(
-option => [$where, $dbName, $dbClass, $default],
);
πΈ DESCRIPTION πΈ
Okay so the Tkx::MegaConfig class gives you implementations of m_configure() and m_cget() that can handle configuration options for megawidgets. The way these methods behave is set up by calling the _Config() class method. _Config() takes a set of option/option spec pairs as arguments.
An option argument is either the name of an option with a leading -, or the string 'DEFAULT' if this spec applies to all options with no explicit spec.
If there is no 'DEFAULT', then unmatched options are applied directly to the megawidget root itself. Thatβs the same behaviour you get if you specify:
__PACKAGE__->_Config(
...
DEFAULT => ['.'],
);
The option spec should be an array reference. The first element of the array ($where) describes how this option is handled. Some $where specs take arguments. If you need to provide an argument, replace $where with an array reference containing [$where, @args]. The rest of the option spec specifies names and default for the options database, but is currently ignored (feature unimplemented).
π The $where specs π
The following $where specs are understood:
.fooβ Delegate the given configuration option to the"foo"kid of the megawidget root. The name"."can be used to delegate to the megawidget root itself. The name".*"can be used to delegate to all kids of the megawidget root.
An argument can be given to delegate using a different configuration name on the "foo" widget. Examples:
-foo => [".inner"], # forward -foo
-bg => [[".", "-background]], # alias
-bg2 => [[".inner", "-background]], # forward as -background
-background => [".*"] # forward --background to kids
METHODβ Call the_config_optmethod. Form_cget()no arguments are given, while form_configure()the new value is passed. If an extra$whereargument is given, it will be the method called instead of_config_opt. Examples:
__PACKAGE__->_Config(
-foo => ["METHOD"];
-bar => [["METHOD", "bar"]],
}
sub _config_foo {
my $self = shift;
return "foo" unless @_;
print "Ignoring setting configuration option -foo to '$_[0]'";
}
sub handle_bar {
my $self = shift;
return "bar" unless @_;
print "Ignoring setting configuration option -bar to '$_[0]'";
}
PASSIVEβ Store or retrieve option from$self->_data.
π LICENSE π
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Copyright 2005 ActiveState. All rights reserved.
π SEE ALSO π
Tkx, Tkx::LabEntry
Inspiration for this module comes from Tk::ConfigSpecs.
Thatβs the whole vibe check: this page is from perl v5.42.2, dated 2026-02-15, and itβs the Tkx::MegaConfig(3) manual page. Slay, bye bestie πβ¨
π¦ where this page comes from
- alpine 3.24: perl-tkx-doc 1.10-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms