Thread Ersatz für "wantarray"
(33 answers)
Opened by Kuerbis at 2016-02-01 11:09
So könnte ich es machen:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 has $!multiselect; sub choose ( Array $orig_list, %opt? ) is export { return Term::Choose.new().choose( $orig_list, %opt ); } sub choose_multi ( Array $orig_list, %opt? ) is export { return Term::Choose.new().choose_multi( $orig_list, %opt ); } method choose () { $!multiselect = 0; self._my_inner_method( ... ); } method choose_multi () { $!multiselect = 1; self._my_inner_method( ... ); } method _my_inner_method ( ... ) { ... ... if $!multiselect { ... } else { ... } } |