P3 - Parrot Presentation Program

# Parrot Proudly Presents

## PPP - aka P3

# Parrot Presentation Program

### P3 Keywords:

- Parrot
- ['HTTP'; 'Daemon']
- Ajax*

- * look Ma - no XML at all

- HTML slide source

# How Does It Work?

## Web browser

Any recent browser (Konqueror, Firefox, Safari) with JavaScript enabled will do. You load the start page of the presentation:

## index.html

The primary webpage of the presention. It uses JavaScript to process keyboard events and XMLHttpRequest to send requests to the web server. The result of the query is placed into the webpage.

index.html could of course be named differently, it's just the start page of the presentation.

        <div id="content">Presentation goes here</div>

# httpd2

well...

# httpd2.pir

httpd2.pir is a tiny web server, using the `['HTTP'; 'Daemon']` class, which supports the GET method and CGI.

      load_bytecode 'HTTP/Daemon.pbc'

# [ HTTP; Daemon]

The webserver is using the asynchronous event system of parrot to accept multiple client requests and serve results. It writes its log file during idle time.

Starting it with some options is as simple as this:

      .local pmc d, opts
      $I0 = find_type ['HTTP'; 'Daemon']
      d = new $I0, opts
      d.'run'()

# CGI

A URI like page.pir?q... load_bytecodes cgi-pir/page.pir and runs a subroutine cgi-main. The result is of course sent back to the browser.

## cgi-pir/slides.pir

This is the actual presentation program, processing the .html source of the presentation. It delivers spliced parts according to the browser request.

# Slides

Slides are taken from one .html page. The tag <h1> starts a new slide page, other top-level tags are placed beyond the previous one after <space> was pressed. Look at the source code of this file :)

    <h1>Slides</h1>
    <p>Slides are taken from one <i>.html</i> page. ...<p>

# Navigation

- <space> - next page
- <left arrow> - previous page
- <right arrow> - next page
- \d+ <enter> - goto page

# Questions?

Why another PP?
  It's fun, it's almost parrot only, it's useful, and fully dynamic.