Shop OBEX P1 Docs P2 Docs Learn Events
which webserver-software is MOST EASY to install and use if I just want to test — Parallax Forums

which webserver-software is MOST EASY to install and use if I just want to test

StefanL38StefanL38 Posts: 2,292
edited 2010-02-01 02:17 in General Discussion
Hello to all the perl and webserverfreaks,

I'm using windows vista. Which is the MOST EASY to install and easy to use webserver if I just want to test some small perl-scripts
that create html-websites?

I know a powerful software has a lot of setup and configuration options
But I DON'T want to dive deeply into webservers.

Ideal would be start setup
confirm standard-installation runs through
start webserver and I'm done

I want to do all LOCAL on my PC. I do NOT plan to upload anything.

any hints are greatly apreciated

best regards

Stefan

Post Edited (StefanL38) : 1/31/2010 6:43:39 PM GMT

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-31 18:46
    I wouldn't bother installing a webserver at all. You can write a very simple one in Perl using HTTP:[noparse]:D[/noparse]aemon.

    -Phil

    Addendum: Here's some sample code to get you started:

    use strict;
    
    use HTTP::Daemon;
    use HTTP::Headers;
    use HTTP::Request;
    use HTTP::Response;
    use IO::Select;
    use Time::HiRes qw/sleep/;
    
    $| = 1;
    
    my $daemon;
    my $port = 8333;
    my $pageaddress = '/testpage';
    my $webpage = webpage();
    $webpage = "Status: HTTP/1.1 200 OK\nContent-Type: text/html\nContent-Length: " . length($webpage) . "\n\n$webpage";
    
    until (
      $daemon = HTTP::Daemon->new(
        LocalAddr => "",
        LocalPort => $port,
        Listen => 5
      )
    ) {sleep 2}
    
    my $readable = IO::Select->new;
    $readable->add($daemon);  
    print "Web server now listening on port $port.\n";
    my $new_readable;
    
    while (1) {
      while (($new_readable) = IO::Select->select($readable, undef, undef, 5)) {
        foreach my $connex (@$new_readable) {
          if ($connex eq $daemon) {
            $readable->add($daemon->accept);
          } elsif (my $req = $connex->get_request) {
            if ($req->method eq 'GET' and $req->url eq $pageaddress) {
              print "Got a request.\n";
              $connex->send_response($webpage)
            } else {
              $connex->send_error(403)
            }
          } else {
            $readable->remove($connex);
            close($connex)
          }
        }
      }
      sleep 0.02
    }
    
    sub webpage {
      return <<END_OF_HTML
    <html>
      <head>
      </head>
      <body>
        <h1>This is a test.</h1>
      </body>
    </html>
    END_OF_HTML
    } 
    
    
    

    Post Edited (Phil Pilgrim (PhiPi)) : 1/31/2010 8:27:21 PM GMT
  • John R.John R. Posts: 1,376
    edited 2010-01-31 20:41
    If Phil's option doesn't get you everything you need:

    Which flavor of Vista? Pro and Ultimate (possibly others) have a version of IIS that can be installed as one of the windows components. Slam Dunk. I do not think the basic "home" version(s) include this as an option.

    Next easiest might be to get one of the Visual Studio Express Versions (free from Micro$oft). You should make sure they will install a web server on your particular flavor of windows. Even if you don't have an interest in the development software, one or more of the various versions should have IIS included.

    I'm sure there are other non-Microsoft products, Apache, etc., but I don't know if they will be the "slam dunk" install you're after or not.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.
    Click here to see my Nomad Build Log
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-01-31 21:44
    Hi Phil,

    thank you very much for pointing me to http:daemon

    in the meantime I managed to install perl and the apache server.
    (don't ask me what was wrong in the file httpd.conf first suddenly it was running)

    Now that I have the apache-server running local I can concentrate on the perl-script

    If I conclude right the code you posted is perl too?
    I'm not familiar with perl - no kidding - I started to look at perl one hour before the initial posting

    I was interested if perl can work with files. Now after reading the backronym "Practical Extraction and Report Language"
    it is very clear that the main thing of perl is to deal with files.

    So very good news for Frank who was asking about that.

    here I found a demoscript to reads a textfile and creates a website from it

    Read a File and Display Contents

    So from here it is just to polish the html-code that the website looks professional
    As I have learned a bit about perl now I think it will even be possible to have one textfile with the fixed text that never changes
    read in this textfile combining it with the dynamic data and create new html-code that shows the actual values with titles date and time etc.

    best regards

    Stefan
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-31 23:18
    Yes, the code I posted is Perl. The P.E.R.L. acronym is ancient. The language has gone way beyond extraction and report!

    BTW, the script you cite has to work in conjunction with Apache's CGI apparatus to deliver any content.

    -Phil
  • JufraJufra Posts: 24
    edited 2010-02-01 01:12
    Thanks guys and especially Stefan for your valuable input.
    As my question was originally around the propeller and the Pink, it has now shifted into a totally different direction and I have to say I am amazed and very grateful for the amount of trouble you've gone into to get me some help.
    It is well received. Thank you!!

    I think what I will do is this (if the pink firmware cannot be fixed):

    1. Have a perl program monitor the serial port for data form the propeller
    2. The part of the serial data that needs to go to the website will be written to a html file which can be accessed through the webserver (I use a linux SME server, so it has a full webserver built in)
    3. The part of the data that I used to send as udp will now be written to another file for logging...

    In this way it is all in the one box and also more stable in the end I believe.
    So here comes another project smilewinkgrin.gif

    As far as connecting the Propeller to the PC goes (through serial), I was looking at this website:
    www.airborn.com.au/serial/rs232.html
    and especially at the heading:
    "Wiring up something nice and simple, for instance a plain old "dumb terminal", is just a matter of connecting Tx, Rx and Ground, right?"

    So Tx and Rx from the prop would just connect to the Rx/Tx in the diagram, yes?

    Am I on the right track here?

    Thanks again
    Cheers
    Frank
  • mctriviamctrivia Posts: 3,772
    edited 2010-02-01 02:17
Sign In or Register to comment.