Sha256: 739a5fd23066fc9579d24be71983d8a6143b45b4fdd65f8ce937753aabdf1a30

Contents?: true

Size: 783 Bytes

Versions: 5

Compression:

Stored size: 783 Bytes

Contents

#!/usr/bin/env ruby

require 'cgi'
require 'erb'

cgi = CGI.new

TEMPLATE = <<-HTML
<!DOCTYPE html>
<html>
  <header>
    <title>CGI Execution</title>
  </header>
  <body>
    <h1>CGI Execution</h1>

    <section>
      <h2>Arguments</h2>
      <ol>
        <% ARGV.each do |val| %>
          <li><%= CGI.escapeHTML(val) %></li>
        <% end %>
      </ol>
    </section>

    <section>
      <h2>Parameters</h2>
      <div><%= CGI.escapeHTML(cgi.params.to_s) %></div>
    </section>

    <section>
      <h2>ENV</h2>
      <dl>
      <% ENV.keys.sort.each do |key| %>
        <dt><%= CGI.escapeHTML(key) %></dt><dd><%= CGI.escapeHTML(ENV[key]) %></dd>
      <% end %>
      </dl>
    </section>
  </body>
</html>
HTML

cgi.out(type: "text/html") do
  ERB.new(TEMPLATE).result
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pione-0.5.0 example/Interaction/bin/show-environment.cgi
pione-0.5.0.alpha.2 example/Interaction/bin/show-environment.cgi
pione-0.5.0.alpha.1 example/Interaction/bin/show-environment.cgi
pione-0.4.2 example/Interaction/bin/show-environment.cgi
pione-0.4.1 example/Interaction/bin/show-environment.cgi