I've been encountered with the "famous" random undefined sub error.
I learned how to fix this error when I call a sub functions from other
library files but, look at below test page.
I am having problem in calling subfunctions(AddNumber) defined in the same
HTML page.
The weired thing is, if I define this sub function at the top of this HTML
page, it generates no error at all. It means I get into trouble when I
define sub-functions at the bottom of each web pages.
I also tried embperl's meta command to define this sub function and called
it using "Execute" but I got still same error.
What am I doing wrong?
----- test.html ------------------
[$var $g_total $num3 $rrr $]
<html>
<head>
<title>test</title>
</head>
<body>
<H1>TEST of AddNumber</H1>
[-
my $num = 5;
my $num2 = 11;
$num3 = 10;
$g_total = AddNumber($num, $num2);
-]
<br>The total is [+ $g_total +].
</body>
</html>
[!
sub AddNumber
{
my ($a, $b) = @_;
my $total = $a+$b+$num3+5;
return ($total);
}
!]
+++++++++++++++++++++++++++++++++
Andrew Lim
Web Developer
California Tan, Inc.
10877 Wilshire Blvd. 12th FL.
Los Angeles, CA 90024
T. 310.824.2508 ext.245
F. 310.824.0082
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]