Hi Sebastian,
Thank you very much.
Actually working solution is:
my $a = "test";
sub test {
print "Hello World!\n";
}
my $b = \&$a;
$b->();
I hope that this code is considered as good style :)
And the real question that needs to be answered first is "What are you
> actually trying to achieve?".
Actually I am writing some helpers for working with one API. Example below
shows why i need to use function name as parameter (string):
sub api_abstraction {
my ($timeout, $params, $is_form, $name_of_parse_function, $is_render) =
@_;
# ...
my $a = \&$name_of_parse_function;
$a->();
}
sub parser1 {
print "Hello World!\n";
# ...
}
sub parser2 {
print "Obama eats children!\n";
# ...
}
my $hash = api_abstraction(7, {product => 'phone', sn => '0001'}, 1,
'parser2', 1);
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.