perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McBride <came...@cwru.edu>
Subject Re: request object in imported subroutines
Date Thu, 19 Sep 2002 13:55:48 GMT
On Thu, Sep 19, 2002 at 03:15:12PM +0200, Andre Landwehr wrote:

<snip>

> [- $req = shift; -]
> [- Execute ({inputfile => 'functions.epo', import => 1}); -]
> [- 
> logprint ("bla bla bla"); # <- this is the function 
> print OUT "my log: $req->{log}"; # here it works
> -]
> 
> functions.epo:
> [$ sub logprint $]
> 	<p>passed values: [+$_[0]+]</p>
> 	<p>logfile: [-print OUT "my log(sub): $req->{log}"; # here not -]</p>
> [$ endsub $]

I did something similiar, but used 'isa' from Execute and OO method call
for my function to pass around the $req object. 

calling page:
[- 
  $req = shift; 
  Execute ({isa=>'lib.epl'})
-]

[- 
  $req->some_func_like_logprint("hello")
-]

lib.epl:
[-
  sub some_func_like_logprint {
    my $req = shift;
    my $msg = shift;
    print OUT "The Req log should be: ", $req->{log}, "<br />";
  }
-]

Perhaps this approach might help, as I think it will give the same
functionality.

Cameron


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


Mime
View raw message