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

How do I take a variable from my script and use the data on my website? I have a script that retrieves data from a 3rd party system via sockets, I then want to take that data and use it to display certain items in a drop down box on the results page(using layout/style from netobjects). The people at netobjects told me to use php or asp. I want to show them that perl can do this task. Any help would be greatly appreciated. Thanks, Dave
  • Comment on Return data from script to a results page

Replies are listed 'Best First'.
Re: Return data from script to a results page
by dragonchild (Archbishop) on Sep 23, 2003 at 19:26 UTC
    Uhhh ... this is bigger question than you have given information for. Questions for you:
    1. Do you have any CGI scripts running right now?
    2. How much do you know about CGI programming?
    3. Is this a page that already exists that you want to modify slightly?
    4. Will netobjects allow you to run a Perl CGI script on their site(s)?
    5. If they do, are you paying for that level of service?
    6. If they do, are you allowed to write it?

    PHP and Javascript have one important capability that Perl does not - you can embed them into a webpage. Perl (usually) requires that you have access to the webserver itself. netobjects recommending PHP or ASP implies, to me, that they don't allow access to the cgi-bin directory. More info would definitely be useful ...

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      1. This is the first script we are using. 2. Enough to be a newbie. 3. Yes the page exists and I want to fill in the fields with the data from the script. 4,5,&6. Yes the isp allows us to use php,asp,perl, it is running on IIS, because our shopping cart uses IIS. We have full writes to the script directory. Thanks, I hope this info helps you.

        Can you describe what you want to do in more detail? It sounds like what you want to do is have a perl script get information from some third party source and then output an HTML page inserting that information where appropriate (probably with pattern matching).

        Does that accurately describe what you want to do? If not, describe it in more detail.

        Also, please use "<p>" to format your writeups here on Perlmonks... much easier to read. Check out Writeup Formatting Tips for more information.

        AH

Re: Return data from script to a results page
by hmerrill (Friar) on Sep 23, 2003 at 20:35 UTC
    So you have the data, and all you need to do is display it in a webpage. The only thing you really need to do is to write out a valid html page to STDOUT - you'll need to enclose your data in or between valid html tags. Not sure what your data looks like, but standard perl module CGI.pm might be the easiest solution for you. CGI.pm has been around for a long time - it makes writing a valid html page a fairly trivial exercise. Do
    perldoc CGI
    at a command prompt to see read the documentation included with the CGI.pm module. Or browse to http://stein.cshl.org/WWW/software/CGI/ to read Lincoln Stein's documentation on CGI.pm.

    HTH.