File: perl.e

package info (click to toggle)
entity 0.7.2-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,352 kB
  • ctags: 5,272
  • sloc: ansic: 61,707; sh: 7,921; makefile: 732; perl: 399
file content (39 lines) | stat: -rwxr-xr-x 1,040 bytes parent folder | download
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
#!/usr/bin/env entity

<object title="Clock">
  <window ondelete="entity:exit" title="Clock" >
    <valign>
      <object title="clock" name="clock" dragable="true" expand="false">
	<label name="time" font="10x20" text = "00:00:00"></label>
	<timer interval = "1000" action="update_clock"></timer>
        <perl>
	    sub update_clock
	      {
                my $node = shift;
		my $timelabel = enode("label.time");
		my $found = enode("/")->child("object.clock");
		$num;
		# aasdfg( - 3;  # this line is for testing the reporting of syntax errors
	        my ($sec, $min, $hour, $mday) = localtime (time);
	        my $str = sprintf ("%02d:%02d:%02d", $hour, $min, $sec);

		$timelabel->attrib("text" => $str);

		print "node = $node\ntimelabel = $timelabel\nfound = $found\n";

		enode("label.time")->attrib(text => $str);


		$num++;
		$found->new_child("button.new-$num", 
				  "label" => "new");

		print $timelabel->attrib("text"), "\n";

	      }
	    update_clock ();
	</perl>
      </object>
    </valign>
  </window>
</object>