in reply to I'm creating a menu and using the input as methods. How do I use arguments?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: I'm creating a menu and using the input as methods. How do I use arguments?
by skrapasor (Novice) on Jun 26, 2008 at 01:12 UTC | |
by NetWallah (Canon) on Jun 26, 2008 at 16:45 UTC | |
by skrapasor (Novice) on Jun 26, 2008 at 16:59 UTC |