raptor wrote:
> 
> script.pl
> ===========
> use Helper;
> my $callbackFunc = \&Helper::func;
> my $obj = new BigOne ( vals => $callbackFunc);
> 
> BigOne.pm
> ==========
> my $vals = shift;
> ....
> if (ref $vals eq 'CODE') {
>    ...........
>     my $kv = &$vals( id => $selected, dbh => $$self{dbh} );
>    ..............
> };
> ....
> 

Let's say your vals gets executed in a subroutine call dispatch(),
then you can pass your args to dispatch() at runtime, and have
it call into your callback with these args, like

$bigOne->dispatch('vars', @args);

sub dispatch {
  my($self, $sub_name, @args) = @_;
  my $code = $self->{$sub_name};
  my $kv = &$code(@args);  
}

Binding your args at runtime will be the most flexible

This is actually how $Response->Include($include, @args) works,
by compiling $include files into a asp perl sub, and then
executing it with @args passed in.

--Josh

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to