in reply to Subroutine references inside of a hash with arguments.
"1" => \&get_ifc_name({'ifc_default' => 'test_me',}),I'm too tired to read all your code, but it seems to me, what you need a classic from functional programming¹:To fix the problem but lose arguments:
"1" => \&get_ifc_name,
use strict; use Data::Dumper; sub get_ifc_name { my %hash=@_; print Dumper \%hash; } sub setdefaults { my ($func,@defs)=@_; return sub { $func->(@defs,@_) } } my $f2= setdefaults( \&get_ifc_name, one =>1); $f2->(two =>2);
OUTPUT
$VAR1 = { 'one' => 1, 'two' => 2 };
Cheers Rolf
FOOTNOTES:
(1) IIRC it's called "currying".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Subroutine references inside of a hash with arguments.
by LanX (Saint) on Jul 24, 2009 at 23:25 UTC |