Debian Codegraph @

test/html/sub.htm

raw
1
2 <html>
3 <head>
4 <title>Define a SUbroutine within Embperl</title>
5 </head>
6
7 <body>
8
9
10 Here we define a subroutine<P>
11
12 NOTE: It must be defined within [[! ... !] to avoid redefinition!
13
14 [!
15
16 # Here we add a comment
17
18 sub Hello
19
20 {
21 # not much to do ...
22 return 'Hello world' ;
23 }
24
25 !]
26
27 Now we call the subroutine: [+ Hello () +] <P>
28
29 $XXXXXX::var = [+ defined ($XXXXXX::var)?$XXXXXX::var:'<undef>' +] <br>
30
31 Setup some variable outside our namespace, which should not be cleaned up<br>
32
33 [- $XXXXXX::var = 1 -]
34
35 $XXXXXX::var = [+ defined ($XXXXXX::var)?$XXXXXX::var:'<undef>' +] <br>
36
37
38 [! sub CLEANUP
39 {
40 print LOG "This will be called before variable cleanup\n" ;
41 undef $XXXXXX::var ;
42 }
43 !]
44
45
46 <P>Ok.<P>
47
48
49 </body>
50 </html>