1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#!/usr/bin/env entity
<object title="Clock">
<window ondelete="entity:exit" title="Clock" >
<valign>
<!-- Insure node lookups are working right by supplying fake
label in different object -->
<label name="time" text="fake! boo!"/>
<object name="clock" dragable="true"
__perl-namespace="different" expand="false">
<label name="time" font="10x20" text = "00:00:00"></label>
<perl>
sub update_clock
{
print "arguments passed to update_clock:";
print "@_\n";
my $timelabel = enode("label.time");
print ("timelabel is $timelabel\n");
my ($sec, $min, $hour, $mday) = localtime (time);
my $str = sprintf ("%02d:%02d:%02d", $hour, $min, $sec);
$timelabel->attrib ("text" => $str);
return "Here is your retval d00d.";
}
sub foo
{
print ("foo!\n");
}
</perl>
</object>
</valign>
<timer name="clock" interval="1000" action="call_update_clock"/>
<perl>
sub call_update_clock
{
my $node = enode ("object.clock");
$foo = "my string foo";
$retval = $node->call ("update_clock", "ns", $node, $foo);
$node->call ("foo");
$node = enode ("label.time");
print ("retval -- $retval\n");
}
</perl>
</window>
</object>
|