perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <ckas...@eplsite.org>
Subject Re: Problem with import subroutine
Date Wed, 06 Aug 2003 20:19:13 GMT
Hi:

Are you using embperl object?, if so, see the next link:
http://take23.org/articles/2001/02/07/embperlobject.xml

If you are NOT using embperl object, the way to solve this problem is like
this:

file index.epl:
[$syntax EmbperlBlocks ASP $] -> this is because i like this kind of syntax
[- Execute ({ inputfile => 'subs.epl', import=>1 }) -]
<html><header><title> this is the title</title></header><body>
    It is the header:
<% $title = &pheader("This is my header");  %>
<%=  do {local $escmode = 0; $title } %>
</body></html>

file subs.epl:
[$syntax EmbperlBlocks ASP $]
[#
    subroutine name: pheader
    purpouse:Prints the page header
#]
[$ sub pheader $]
<%
    $title = shift;
    $thetitle = "<center><b>".$title."</b></center>\n";
    return($thetitle);
%>
[$ endsub $]

------------------------------

If you want global subs, you can do like the example below:



file index.epl:
[- $globalp = shift; -]
[- $optRawInput = 1 -]
[-    Execute ('subs.epl'); -]
<html> <head><title> test </title></head><body>
[- $optRawInput = 1 -]
[-
    local $escmode = 0;
    $globalp->{mytitle}("<big>My main title</big>");
-]
</body></html>

file subs.epl:
[$ syntax EmbperlBlocks ASP $]
<%
    $globalp = shift;

    $globalp->{mytitle} =
    sub
    {
        my $title = shift;
        print OUT "$title";
    };
%>


I hope this helps

Carlos Kassab

> Hi ,
> I have two scripts.
>
> base.htm
> index.htm
> ----------
>
> index.htm :
>
> [-
> 	sub test {
> 		return 'wellcome';
> 	}
> -]
>
>
> base.htm :
>
> [- Execute ({inputfile => '*' , import => 1 }) -]
> [+ test () +]
>
>
> When I run index.htm then base.htm return error , because no find
> subroutine test. Subroutine test don't import to base.htm . Why ?
>
> Thanks , Rado.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message