DragonFly BSD
DragonFly kernel List (threaded) for 2003-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Fw: new sysinstall

From: "Wesley Moxam" <wmoxam@xxxxxxxxxxx>
Date: Tue, 2 Sep 2003 11:05:10 -0400

----- Original Message ----- 
From: "Matthew Dillon" <dillon@xxxxxxxxxxxxxxxxxxxx>
Sent: Monday, September 01, 2003 12:13 PM
Subject: Re: new sysinstall

>     Ruby and Python are still candidates.  To be able to choose one (or to
>     choose to stick just with PHP4) we need some questions answered:
>     * Since we are web based we need persistent storage that is easy to
>       access.  PHP4 has this.  Can we get it with Ruby and/or Python?

Ruby does , persistant storage is made available through the PStore class in
the base library.

require "pstore"

       class T
         def initialize(val, left=nil, right=nil)
           @val, @left, @right = val, left, right
         def to_a
           [ @val, @left.to_a, @right.to_a ]

       store = PStore.new("/tmp/store")

       # store some data
       store.transaction do
          store['names'] = [ 'Douglas', 'Barenberg', 'Meyer' ]
          store['tree']  = T.new('top',
                             T.new('A', T.new('B')),
                             T.new('C', T.new('D', nil, T.new('E'))))

       # now read it back in
       store.transaction do
          puts "Roots: #{store.roots.join(', ')}"
          puts store['names'].join(', ')
          puts store['tree'].to_a.inspect

I'm not sure about python, but the newest version of ruby (1.8) has an
intergrated http server library with it makes it easy to write servlet type
apps. Here's a simple servlet:

require 'webrick'
include WEBrick

s = HTTPServer.new( :Port => 2000 )

s.mount_proc("/hello"){|req, res|
  res.body = "<HTML>hello world</HTML>"
  res['Content-Type'] = "text/html"
}trap("INT"){ s.shutdown }

This way you could eliminate apache as a dependancy.

 -- Wes

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]