chiark / gitweb /
Move nascent website here
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Aug 2009 20:15:11 +0000 (21:15 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 9 Aug 2009 20:15:11 +0000 (21:15 +0100)
yarrg/mason/.perl-lib [new symlink]
yarrg/mason/check [new file with mode: 0644]
yarrg/mason/pirates [new file with mode: 0644]

diff --git a/yarrg/mason/.perl-lib b/yarrg/mason/.perl-lib
new file mode 120000 (symlink)
index 0000000..a96aa0e
--- /dev/null
@@ -0,0 +1 @@
+..
\ No newline at end of file
diff --git a/yarrg/mason/check b/yarrg/mason/check
new file mode 100644 (file)
index 0000000..56a1be1
--- /dev/null
@@ -0,0 +1,7 @@
+<html><head><title>Stuff</title></head>
+<body><pre>
+@INC = <% join ':', @INC |h %>
+% foreach my $e (sort keys %ENV) {
+<% $e |h%>=<% $ENV{$e} |h%>
+% }
+</body>
diff --git a/yarrg/mason/pirates b/yarrg/mason/pirates
new file mode 100644 (file)
index 0000000..5378cf4
--- /dev/null
@@ -0,0 +1,66 @@
+<HTML>
+<HEAD>
+<TITLE>test pirate page</TITLE>
+</HEAD>
+<BODY>
+
+<html><head><title>Select island</title></head><body>
+<form action="/ucgi/~clareb/mason/something" method="get">
+<select name="islandid">
+<%perl>
+my $sth=$dbh->prepare("SELECT islandid,archipelago,islandname
+                              FROM islands
+                              ORDER BY archipelago,islandname;");
+$sth->execute();
+</%perl>
+% my $row;
+% while ($row=$sth->fetchrow_hashref) {
+<option value="<% $row->{'islandid'} |h %>"><% $row->{'archipelago'} |h %> -
+<% $row->{'islandname'} |h %>
+% }
+<input type=submit name=submit value="Go">
+</form>
+
+
+use DBI;
+
+our $dbh;
+our $dbfn;
+$dbfn= "/home/ijackson/things/ypp-sc-tools.pctb-dict-test/yarrg/OCEAN-Midnight.db";
+    $dbh=DBI->connect("dbi:SQLite:$dbfn",'','',
+                       { AutoCommit=>0,
+                         RaiseError=>1, ShowErrorStatement=>1,
+                         unicode=>1 })
+        or die "$dbfn $DBI::errstr ?";
+    # default timeout is 30s which is plenty
+
+my $sth=$dbh->prepare(
+    "SELECT a.commodname,b.price,c.price,d.stallname,e.islandname
+     FROM commods as a
+     JOIN buy as b on a.commodid=b.commodid
+     JOIN buy as c on a.commodid=c.commodid
+     JOIN stalls as d on d.stallid=b.stallid
+     JOIN islands as e on e.islandid=d.islandid
+     WHERE a.commodname like 'Wood'
+     ");
+
+$sth->execute();
+</%perl>
+<table frame=box rules=all>
+<!--
+<tr><td>Island</td><td>Arch</td><td>Stall</td><td>buy price</td><td>sell price</td></tr>
+-->
+% my @row;
+% while (@row=$sth->fetchrow_array) {
+<tr>
+% foreach my $cell (@row) {
+<td>
+<% $cell %>
+</td>
+% }
+</tr>
+% }
+</table>
+
+</BODY>
+</HTML>