You can call $method like this:
(Untested).$bot->$method(\&GetInput, \&ShowOutput); # In your main program, you have to define sub GetInput{...}, # and sub ShowOutput{...} # Alternatively, use anonymous subs : $bot->$method(sub{print $_[0]; return scalar <>}, sub{print $_[0] . "\n"});
To complete the picture, here is how $method would use the passed callbacks ..
sub method{ my ($self, $getInput,$SendOutput) = @_; my $input = $getInput->("Optional PROMPT parameter, if any\n"); #.. Do something with $input, and generate $output $SendOutput->($output); }
Have you been high today? I see the nuns are gay! My brother yelled to me...I love you inside Ed - Benny Lava, by Buffalax
In reply to Re: I'm creating a menu and using the input as methods. How do I use arguments?
by NetWallah
in thread I'm creating a menu and using the input as methods. How do I use arguments?
by skrapasor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |