On 2005-08-30, Kleindenst, Fred <suppressed> wrote:
>
> OK so far, I want to use the mentioned anonymous sub. I'm not sure on
> the syntax.
Here's one way to check it:
sub foo {42};
use Data::Dumper;
print Dumper ( \foo(), \&foo );
You'll see you get different results. The first syntax is reference
to the output of a subroutine. The second syntax is a reference to
the subroutine itself. That's what you want.
> (How do I specify the input to pass in?)
You don't and you can't. When you declare a DFV profile, you don't know the
values will be, because the validation step hasn't happened yet.
That's OK because you don't need to /execute/ the subroutines in your profile,
you just need to /declare/ them.
DFV will pass in arguments and execute the subroutine as part of the
processing.
The concept was used widely in DFV 4.0 to clean up the API. For more
in-depth learning on this topic, I recommend the book Higher Order Perl,
which is all about subroutines that have other subroutines as inputs or
outputs.
Mark
--
http://mark.stosberg.com/
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.