Hi John,

> -----Original Message-----
> From: Thompson, John [mailto:jth...@midwestern.edu] 
> Sent: Wednesday, 23 June 2010 5:31 AM

> Ok so I figured out that the Execute( param => ... ) still 
> goes into @param not @_. Any idea why the ( object => 
> $template ) isn't working?

I use the following idiom quite successfully under Embperl::Object:

base.epl:

  ...
  $lib = Execute({object => 'lib.epl'});
  ...

And then later in one of the main template files:

  ...
  $lib->my_function( $arg1, $arg2 );
  ...

There is nothing special about lib.epl other than it only defines
subroutines. These are either perl subs in a [! !] block or [$ sub $]
constructs depending on whether they need to output HTML. There are
both, mixed interchangeably.

For example, lib.epl:

[!
  sub just_some_calculation {
    my $self = shift;
    my ($x, $y) = @_;
    return $x * $y;
  }
!]

[$ sub other_func $]
[-
  my $self = shift;
  my $arg1 = shift;
 -]
[+ $arg1 +]
[$ endsub $]


There isn't much else to it. Hope that helped.

Cheers,

Andrew

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

Reply via email to