File: demo.func.phtml

package info (click to toggle)
eperl 2.2.14-21
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,304 kB
  • ctags: 738
  • sloc: ansic: 4,694; perl: 584; sh: 556; makefile: 353
file content (42 lines) | stat: -rw-r--r-- 1,010 bytes parent folder | download | duplicates (7)
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
<!-- 
##
##  demo.func -- ePerl demonstration webpage
##  Copyright (c) 1996,1997 Ralf S. Engelschall, All Rights Reserved. 
-->
<html>
<head>
<title>demo.func</title>
</head>
<body>
<blockquote>
<blockquote>
<h1>demo.func</h1>
<h2>Perl Programming</h1>
<p>

<?
sub ctime {
    my ($time) = @_;
    my @dow = ( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' );
    my @moy = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
    my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = 
        localtime($time);
    my ($str) = sprintf("%s %s %2d %02d:%02d:%02d %s%s",
         $dow[$wday], $moy[$mon], $mday, $hour, $min, $sec, $year+1900, 
         $isdst ?  " DST" : "");
    return $str;
}
!>

This demonstrates the global scoping within a webpage by defining
a Perl function in a first ePerl block and later calling this
function in another ePerl block.

<p>
Local time is <?=&ctime(time())!>.

</blockquote>
</blockquote>
</body>
</html>