Hi, Todd & Jeff, :)
From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]>
> On Nov 13, todd shifflett said:
>> the above works. Now I would like to be able to pass in a
>> subroutine from a declared object.
> You mean a "method" (that is, a function that is "bound" to an object).
>> my $fft = new Ma
I have not had a chance to try this yet but it sounds very promising.
Begin forwarded message:
From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]>
Date: Wed Nov 13, 2002 2:02:59 PM US/Pacific
To: [EMAIL PROTECTED]
Subject: Re: code ref and objects
On Nov 13, todd shiffle
Hi
Can u do the following change
Use local instead of my
my is defined only within its scope.i.e subfunction..it is not recognised elsewhere.
c if it works
thanx
-
Sify Mail - now with Anti-virus protection powered by Trend Micro, USA.
Know mor
Hi, Todd (and Wiggins!), :)
On Wed, 13 Nov 2002, todd shifflett wrote:
> I am trying to use a code reference from within a function to
> recursively call a given separate function...
> #--- LIKE THIS --vv
> sub hello {
> my $name = shift;
> return "Hello, $name!\n";
> }
>
> sub foo
This is a guess but I think you can't 'my' the fft variable and then use
it as a reference. Because it is looking for main:: which your my'd
variable will not be in that namespace, or any namespace for that
matter. If you are working under use strict trying our'ing it instead,
or just removin
I am trying to use a code reference from within a function to
recursively call a given separate function...
#--- LIKE THIS --vv
sub hello {
my $name = shift;
return "Hello, $name!\n";
}
sub foo {
my($f, @args) = @_;
return &$f(@args);
}
print foo(\&hello, "world");
#---^^
the above work