Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: Embperl
Execute( sub =>...) and (object => ...)
 

Index | Next | Previous | View Flat


jthomp at midwestern

Jun 22, 2010, 10:49 AM


Views: 1334
Permalink
Execute( sub =>...) and (object => ...)

I am attempting to #1 determine if a function is defined in a template
and if so #2 call it sending it parameters all from outside the
template.



I first thought I might just grep for [$ sub name $] and if found do:



my $html;

Embperl::Execute({inputfile => $template},

sub => 'name'

param =>
[$param1,$param2,$param3],

output => \$html});



But it doesn't seem that "param" feeds the subroutine (and it doesn't
feed the template either), so I can't figure out how to get parameters
to my function.



Then I thought I'd try to do:



my $object = Embperl::Execute({object => $template});

if($object->can('name')) {

$object->name($param1,$param2,$param3);

}



But for some reason, $object is always equal to zero. Does the template
need to have a package declaration? Not sure what I'm doing wrong.
Either of these ways would work, any help is appreciated.

Subject User Time
Execute( sub =>...) and (object => ...) jthomp at midwestern Jun 22, 2010, 10:49 AM
    RE: Execute( sub =>...) and (object => ...) jthomp at midwestern Jun 22, 2010, 12:31 PM
    RE: Execute( sub =>...) and (object => ...) andrewo at oriel Jun 22, 2010, 6:13 PM
    RE: Execute( sub =>...) and (object => ...) gerald.richter at ecos Jun 22, 2010, 8:33 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.