in reply to Re^3: become another via exec in dispatch table
in thread become another via exec in dispatch table
my %cmds = ( a => sub {exec 'perl', '-e', 'print map {qq!\t$_\n!} @ARG +V', @_}, b => sub {exec 'perl', '-e', 'print map {qq!\t$_\n!} @ARG +V', @_}, b1 => sub {exec 'perl', '-e', 'print map {qq!\t$_\n!} @_' +, @_}, b2 => sub {exec 'perl', '-e', 'print qq!@ARGV!', @_}, c => sub {my $res; foreach (@ARGV) {$res+=$_}; print $res +;exit 0 }, ); ## # calling with --key a b b1 b2 like in # dispatch.pl --execute --key a A B C # everytime produces: # #ole #--a blank line-- #only the c key runs as expected (to me) but not use exec #c:\SCRIPTS>dispatch.pl --execute --key c 1 2 3 4 5 #ole #15 #c:\SCRIPTS> #key c in a pipeline produces: #c:\SCRIPTS>echo 1 2 3 | dispatch.pl --execute --key c #ole #Use of uninitialized value $res in print at c:\SCRIPTS\code-dispatch. +pl line 16. c:\SCRIPTS>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: become another via exec in dispatch table
by ikegami (Patriarch) on Jan 31, 2012 at 21:18 UTC | |
|
Re^5: become another via exec in dispatch table
by ikegami (Patriarch) on Jan 31, 2012 at 21:24 UTC |