Well, it wasn't obvous to me. So, what does sub{}
actually do?

I'm clear about ...

my $code_ref = sub{ print "sth" }

as I've wrapped some perlcode in a code ref ;)

I'm clear about ....

sub func_to_invoke() {
  print "sth"
}

my $code_ref = \&func_to_invoke()

but my problem involved a ref to a class and a
function name which I haven't seen documented.

Unless s.o. can point me to the right place.

Thanks for the tip and any more info on what is
actually happening when we invoke sub{} would be
great.


-Ants 

--- John ORourke <[EMAIL PROTECTED]> wrote:

> Anthony Gardner wrote:
> 
> >and I need a code ref. The thing is, I can't make a
> >code ref out of ....
> >
> >$self->method_to_invoke( $arg1, $arg2 );
> >  
> >
> I'm going to get into trouble for stating the
> obvious here but have you 
> tried:
> 
> $code_ref = sub { return shift->method_to_invoke( @_
> ) }
> 
> (ie. create a new anonymous method which is just a
> wrapper for your 
> method - if your method is really quick and you're
> iterating *lots* it 
> may affect timing a little)
> 
> John
> 
> 



                
___________________________________________________________ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

Reply via email to