
Sub::Apply - apply arguments to proc.

use Sub::Apply qw(apply apply_if);
{
my $procname = 'sum';
my $sum = apply( $procname, 1, 2, 3);
}
{
my $procname = 'sum';
my $sum = apply_if( $procname, 1, 2, 3);
# not die if $procname does not exist.
}

Sub::Apply provides function apply and apply_if. This function apply arguments to proc.
This module is designed for function call. If you want to call class method or instance method, I recommend you to use UNIVERSAL#can.

apply, apply_if

Apply @args to $procname. If you want to call function that not in current package, you do like below.
apply('Foo::sum', 1, 2)
This method looks up a function using symbol table and call it. But this function DOES NOT USE @ISA to look up. This behavior is same as perl funciton call style.
Same as apply. But apply_if does not die unless $procname does not exist.
You can set $Sub::Apply::WARNING=1 for debugging.

apply and apply_if cannot call CORE functions.

Yoshihiro Sasaki, <ysasaki at cpan.org<gt>

Copyright (C) 2011 by Yoshihiro Sasaki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.