configure documentation

Kevin Ballard kevin at sb.org
Wed Sep 7 20:02:42 EDT 2005


I'd just like to mention that on my to-do list (something I hope to  
clear up within the next few days) is a way to make doing script  
configuration much easier. That said, nothing is certain, so feel  
free to implement it with the current functionality.

On Sep 7, 2005, at 2:37 PM, why the lucky stiff wrote:

> 1) Ajax + mount.  MouseHole has the simple sendReq function you can  
> use to communicate setting alterations.  If your script mounts a  
> directory, pass information to the mount.  (You'll probably want to  
> clearly mark that these are updated without submission.)
>
> 2) The HTTPRequest#query object.  If you have form fields in your  
> configure block, the submitted contents will be stored in the  
> WEBrick::HTTPRequest#query object.  (The second parameter coming  
> into the object.)
>
>  configure do |req, res|
>    if req.request_method == "POST"
>      self['username'] = req.query['username']
>    end
>    %{<input type="text" name="username" value="#{ self 
> ['username'] }" />}
>  end
>
> Your script has its own object database (using YAML::DBM).  You can  
> stuff anything you like in the database by using self[]=.  Read it  
> back out with self[].

-- 
Kevin Ballard
kevin at sb.org
http://www.tildesoft.com
http://kevin.sb.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2378 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/mousehole-scripters/attachments/20050907/cc26887a/smime.bin


More information about the Mousehole-scripters mailing list