Well, since in the previous post about Parrot we focused on Perl6 and some people have commented whether it is only good for that, let us see another example of what can be done : a personal http server.
First of all, if we are on Debian, we install PerlDoc:
apt-get install perl-doc
Since we are just testing, we are going to go to the /tmp directory so that we do not have to worry about disk space (/tmp is only deleted on reboots) and there we will download parrot from the Parrot svn.
cd /tmp
svn co https://svn.parrot.org/parrot/trunk parrot
Once we have downloaded the source we go straight on to configure and compile Parrot. On this occasion we do not download any language, since the example we are going to try is in Pir (Parrot Intermediate Representation), a sort of high level assembler.
cd parrot
perl Configure.pl && make
Once we have Parrot compiled, we are going to generate the documentation in HTML; we have to serve something on our server and the Parrot documentation is ideal 🙂 For that we will simply do a make html, which will take care of going through all the sources that have information in pod (Plain Old Documentation) format and will turn it into HTML.
make html
So we are almost finished. Without leaving the directory we run Parrot with the code that lets it behave as an http server.
./parrot examples/io/httpd.pir &
And there we are, we launch our favourite browser against our local IP on port 1234.
mozilla 127.0.0.1:1234
Simple, is it not? Well, we now have access to a lot of information that we can read comfortably. The http server is only an example that comes with Parrot and that has some configuration options; I recommend reading the code since it is quite simple and very clearly implemented.