[Petal] Accessing coderefs
    Bruno Postle 
    bruno at mkdoc.com
       
    Thu Mar 23 17:25:37 GMT 2006
    
    
  
On Mon 20-Mar-2006 at 09:09 -0500, Peter Rabbitson wrote:
>
> Petal gives me no problems if I am to use object/method and supply
> parameters. In my case it is very problematic to supply an object to
> process(), so I was wondering if there is a way to call a coderef.
No, it seems that Petal explicitly stops you passing parameters to 
anything that isn't an object.
The following patch seems to make this work, though it hasn't had 
any thorough testing.  Can you try it out?
Index: lib/Petal/Hash/Var.pm
===================================================================
RCS file: /var/spool/cvs/Petal/lib/Petal/Hash/Var.pm,v
retrieving revision 1.17
diff -r1.17 Var.pm
98a99,100
>           unless (isa $current->{$next}, 'CODE')
>           {
100a103
>           }
130c133
<       $current = (isa ($current, 'CODE')) ? $current->() : $current;
---
>       $current = (isa ($current, 'CODE')) ? $current->(@args) : $current;
    
    
More information about the Petal
mailing list