Prima::Object is a Perl module with Prima toolkit base classes.
SYNOPSIS
if ( $obj-> isa('Prima::Component')) {
# set and get a property
my $name = $obj-> name;
$obj->name( 'an object' );
# set a notification callback
$obj-> onPostMessage( sub {
shift;
print "hey! I've received this: @_n";
});
# can set multiple properties. note, that 'name' and 'owner',
# replace the old values, while onPostMessage are aggregated.
$obj-> set(
name => 'AnObject',
owner => $new_owner,
onPostMessage => sub {
shift;
print "hey! me too!n";
},
);
# de-reference by name
$new_owner-> AnObject-> post_message(1,2);
}
Prima::Object and Prima::Component are the root objects of the Prima toolkit hierarchy. All the other objects are derived from the Component class, which in turn is the only descendant of Object class. Both of these classes are never used for spawning their instances, although this is possible using
Prima::Component-> create( .. parameters ... );
call. This document describes the basic concepts of the OO programming with Prima toolkit. Although Component has wider functionality than Object, all examples will be explained on Component, since Object has no descendant classes and all the functionality of Object is present in Component. Some of the information here can be found in Prima::internals as well, the difference is that Prima::internals considers the coding tasks from a C programmer's view, whereas this document is wholly about perl programming.
Product's homepage
Requirements:
· Perl