Prima is a graphical toolkit actually developed and maintained by Dmitry Karasik, now at version 1.34. If offers a large set of feature that makes it a good choice for anyone looking for an event driven environment.

Prima basic concept is that of building an application as a process of creating windows, adding any needed menus, childs, images, properties, and relationships and then starting the whole.

The basic use directives to use Prima are:

use Prima; use Prima::Application; use Prima::ComboBox;

and so on or using the qw syntax:

use Prima qw (Application ComboBox);

When we have available the modules we could start creating a window that will be the main window of our application.

$mw = Prima::MainWindow->create ( # here there are some options, mainly that more common: size => [400,400], menuItems => [[ "~File" => [ [],# division line [ "E~xit" => "Exit" ] ]]], # events onPaint => sub { my ($self, $canvas) = @_; $canvas-> clear; $canvas-> color(cl::Red); $canvas-> line( 0, 0, 800, 800); );

After we could add an object to the created window $mw using the insert:

$mw->insert('ComboBox', name => 'ComboBox', size => [ 100, 100], );`

and after this work we run the:

run Prima;

to get all built and executed.

Options used in the main window for this conceptual example, are size and menuItems. About the size there no much to say at this time but I would already spend some word on menuItems.

As shown the menuItems gets the menu structure. In real examples, as I will show later, it is a better and suggested solution to separate the menu in a subroutine that returns the menu and change the menuItems to:

menuItems => menu(),

The snippet contains also an example of events. In this case we have the onPaint event, which is triggered when the windows is painted. When the event occurs the sub will be executed, at least at the beginning when the windows is created, causing the line to be drawn on the screen.