http://qs1969.pair.com?node_id=266241

Concept99 has asked for the wisdom of the Perl Monks concerning the following question:

I'm not sure if this is even possible, but I'll ask anyway. I am creating an ASP page that (among other things) will allow a user to select an item from a dropdown menu. What I am wanting to know is if it is possible to pass that selection value to a Perl script, and then run the script. For example, the dropdown menu will contain server paths. The perl script would ideally accept the selected server path that is passed to it, and then determine the disk size of that path.

I'm not really sure how to call a Perl script from an ASP page.
I'm also not real sure how to accept input into my Perl script from asp/html.

The reason I am using ASP is because I'm running on a IIS 5.0 Web Server. If it's possible to do this in HTML, that would work also. I'd appreciate any input on this. Thanks in advance.

Replies are listed 'Best First'.
Re: Pass html selection to perl script
by hardburn (Abbot) on Jun 16, 2003 at 18:10 UTC

    There is nothing special about passing params to Perl. You build your form in HTML, with the action attribute of the <form> tag pointing to the Perl CGI. Then, you use CGI to pull those parameters once the CGI has been called. Example:

    use CGI qw(:standard); my $param1 = param('param1'); my $param2 = param('param2'); my $param3 = param('param3');

    And so on.

    See also: Ovid's CGI course (external link).

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

Re: Pass html selection to perl script
by cfreak (Chaplain) on Jun 16, 2003 at 18:21 UTC

    Perl can do anything ASP can do (and IMHO it can do it better but that's probably what do you expect from a Perl site)

    My advice: code in one language. ASP and Perl can both be used to generate HTML pages and be used to retrieve the value of a select box, like you describe, and do something with it. You're asking for a maintnence nightmare if you code part of it in one and part of it in another

    Lobster Aliens Are attacking the world!
Re: Pass html selection to perl script
by arthas (Hermit) on Jun 16, 2003 at 18:44 UTC

    Since you've got perl installed on the system where IIS runs, you can configure it also to work with Perl scripts. So, you don't need to bother with ASP unless you really want to, and you can do all the work in Perl.

    To answer to the first part of your question also, you can easily grap form parameters from withing a Perl script by using CGI.

    Michele.