Creates a new widget from a .glade file. It accepts the following parameters.
The full path name of the glade file to use.
the name used in the glade file for the container widget to use.
A name for the widget. This is used to allow more than one widget to be in the same session. The state names are then constructed by concatenating the method name you pass in the states parameter with this name, seperated by an underscore:
$state = "$method\_$name";
It is easy to use the widget name used for the custom widget in the container glade file for this, as this is passed to your constructor.
package FooWidget; use base qw(Glade2::Widget);
sub new { my $class, $name, undef, undef, undef, undef) = @_; my $self = { ... name => $name, }; ... }
The example above also shows that you get String1, String2, Int1 and Int2 fields you can specify in Glade in your constructor as well. Not exactly a great API, but it can be useful for some things.
a list of extra POE states to register. These are registered as object states, with the widget as the object.
This method is used to call a poe event METHODNAME with optional ARGUMENTS. It is mainly useful for calling events on widgets that have more than one instance in a session, as it turns METHODNAME into the proper event name that was autogenerated to avoid duplication.
To install Glade2::Widget, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Glade2::Widget
CPAN shell
perl -MCPAN -e shell install Glade2::Widget
For more information on module installation, please visit the detailed CPAN module installation guide.