Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

In-line user input in a sub

Quote Reply
In-line user input in a sub
Is there anyway I can get a "Yes" or "No" from a user without having to leave a sub to process the results?

Example:

sub {

blah blah

my $answer = USER INPUT - YES OR NO

process my $answer

}



I keep thinking that the answer may lay in having another function which is called to gather the input, then return this to my sub calling the funcion:

sub {

blah blah

my $answer = &UserInput();

process my $answer

}



What should &UserInput() look like??Crazy


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] In-line user input in a sub In reply to
Do you want the yes/no to be defined before, or to be run in real time when they run the function? If you want it to be pre-defined, how about a uiser variable? Unsure

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] In-line user input in a sub In reply to
Hi Andy,

No, this is a "Confirm you want to delete?" type of thing... so input on the spot type of thing.

I was thinking of an alert box in the browser, but I am not sure all browsers support that, or even if that will work in this case?


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] In-line user input in a sub In reply to
I am going to try something based on this:

<script>
var x=window.confirm("Are you sure you are ok?")
if (x)
window.alert("Good! - carry on with the rest of the sub")
else
window.location ="somehow leave this sub :-("
</script>


If anyone has any suggestions on how to complete this, or better solutions, I'd love to hear.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] In-line user input in a sub In reply to
Maybe some form of:

my $input = <STDIN>;
chomp($input);


??Unsure


http://www.iuni.com/...tware/web/index.html
Links Plugins