--fOHHtNG4YXGJ0yqR
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

	Hello,

The following code doesn't work in Apache, but works in Webrick.
In Apache, after pressing any button on page I got this page:

Exception in #: undefined method `call' for nil /home/radek/opt/ruby-1.8.0-=
2003.05.22/lib/ruby/site_ruby/1.8/borges/Renderer.rb:126:in `process_callba=
cks' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Re=
nderer.rb:126:in `each' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site=
_ruby/1.8/borges/Renderer.rb:126:in `process_callbacks' /home/radek/opt/rub=
y-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Renderer.rb:20:in `render_=
response' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borg=
es/Renderer.rb:6:in `render' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby=
/site_ruby/1.8/borges/Page.rb:31:in `response_loop' /home/radek/opt/ruby-1.=
8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Page.rb:31:in `loop' /home/rad=
ek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Page.rb:31:in `r=
esponse_loop' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/=
borges/Page.rb:24:in `go' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/si=
te_ruby/1.8/borges/Page.rb:24:in `callcc' /home/radek/opt/ruby-1.8.0-2003.0=
5.22/lib/ruby/site_ruby/1.8/borges/Page.rb:24:in `go' /home/radek/opt/ruby-=
1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Page.rb:16:in `call' /home/r=
adek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb:118=
:in `unknown_request' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_r=
uby/1.8/borges/Session.rb:108:in `handle_request_intern' /home/radek/opt/ru=
by-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb:101:in `callcc=
' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Sessi=
on.rb:110:in `handle_request_intern' /home/radek/opt/ruby-1.8.0-2003.05.22/=
lib/ruby/site_ruby/1.8/borges/Session.rb:43:in `initialize' /home/radek/opt=
/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb:42:in `sync=
hronize' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borge=
s/Session.rb:42:in `initialize' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/r=
uby/site_ruby/1.8/borges/Session.rb:41:in `loop' /home/radek/opt/ruby-1.8.0=
-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb:47:in `initialize' /ho=
me/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb=
:35:in `start' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8=
/borges/Session.rb:35:in `initialize' /home/radek/opt/ruby-1.8.0-2003.05.22=
/lib/ruby/site_ruby/1.8/borges/Application.rb:93:in `new' /home/radek/opt/r=
uby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Application.rb:93:in `ne=
w_session' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/bor=
ges/Application.rb:83:in `handle_request' /home/radek/opt/ruby-1.8.0-2003.0=
5.22/lib/ruby/site_ruby/1.8/borges/Application.rb:43:in `handle_request' /h=
ome/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/ApacheDRb=
Server.rb:30:in `handle_request' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/=
ruby/site_ruby/1.8/drb/drb.rb:688:in `__send__' /home/radek/opt/ruby-1.8.0-=
2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:688:in `perform_without_block'=
 /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:65=
2:in `perform' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8=
/drb/drb.rb:761:in `main_loop' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ru=
by/site_ruby/1.8/drb/drb.rb:757:in `loop' /home/radek/opt/ruby-1.8.0-2003.0=
5.22/lib/ruby/site_ruby/1.8/drb/drb.rb:775:in `main_loop' /home/radek/opt/r=
uby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:753:in `start' /home=
/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:753:in `=
main_loop' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb=
/drb.rb:599:in `run' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ru=
by/1.8/drb/drb.rb:596:in `start' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/=
ruby/site_ruby/1.8/drb/drb.rb:596:in `run' /home/radek/opt/ruby-1.8.0-2003.=
05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:549:in `initialize' /home/radek/opt=
/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:783:in `new' /home=
/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:783:in `=
start_service' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8=
/borges/ApacheDRbServer.rb:14:in `start' ./kontejner_srv.rb:11


The source is:
#!/usr/bin/env ruby
# $Header: /home/radek/cvs/mpress-kontejnery/kontejner.rb,v 1.1.1.1 2003/05=
/22 10:03:46 radek Exp $
# Datab=E1ze kontejner=F9 na barvu.
# Copyright (C) 2003 Radek Hnilica

require 'borges'
require 'borges/Page'
require 'dbi'
include Borges

class Kontejner < Page
    attr_reader :username

    def initialize
    end

    def render_on(r)
	r.table({'frame'=3D>'border', 'rules'=3D>'all'}) do
	    # Table headers
	    r.tr do
		r.print "<th>Kontejner</th><th>p=F8ijat</th>"
	    end
	    #render_table_buttons(r)
	    DBI.connect('DBI:pg:kontejner:localhost', 'kontejner', 'XXXXXXXX') do =
|dbh|
		dbh.select_all(<<-EndOfSQL
			       SELECT kontejner_id, prijato
			       FROM kontejner
			       ORDER BY kontejner_id;
			       EndOfSQL
			       ) do |row|
		    r.tr do
			id,pri =3D row
			r.print <<-EOF
			<td>#{id}</td>
			<td>#{pri}</td>
			EOF
			# Line Buttons
			r.td do
			    r.form do
				r.submit({'value'=3D>'Del'})
			    end
			end
		    end
		end
	    end
	    r.tr do
		r.form do
		    id =3D pri =3D nil
		    r.td{r.text_input(''){|id|}}
		    r.td{r.text_input(''){|pri|}}
		    r.td{r.submit({'value'=3D>'Add'}){}}
		end
	    end
	end
    end

    def render_line_buttons(r)
    end

    def render_table_buttons(r)
	r.tr do
	    r.form do
		id =3D pri =3D nil
		r.td{r.text_input(''){|id|}}
		r.td{r.text_input(''){|pri|}}
		r.td{r.submit({'value'=3D>'Add'}){add_kontejner(id,pri)}}
	    end
	end
    end

    def add_kontejner(id, pri)
	puts "add_kontejner(#{id}, #{pri})"
	#DBI.connect('DBI:pg:kontejner:localhost', 'kontejner',  'XXXXXXXX') do |d=
bh|
	#    dbh.do <<-EndOfSQL
	#    INSERT INTO kontejner (kontejner_id, prijato)
	#    VALUES ('#{id}', '#{pri}');
	#    EndOfSQL
	#end
    end
end

if $0 =3D=3D __FILE__ then
    require 'borges/Webrick'
    Borges::register_application("kontejner", Kontejner)
    Borges::WebrickConnection.start({:Port=3D>7777})
end

#Keep this comment at the end of the file
#Local variables:
#End:


It's based on code published on
http://www.penguin.cz/~radek/book/borges/index.html

The apache is 1.3.26-0woody3, ruby the latest from cvs so borges.

--=20
Radek Hnilica <Radek at Hnilica dot CZ>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
No matter how far down the wrong road you've gone, turn back.
						Turkish proverb




--fOHHtNG4YXGJ0yqR
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+zMS904obroM0taURArx1AJ9qpq7rYbKA2NOh8pJCxAweu+vcvACgq21g
geXsEFYeGqfEKiu6nHAmhu0=
=LCwI
-----END PGP SIGNATURE-----

--fOHHtNG4YXGJ0yqR--

	Hello,

The following code doesn't work in Apache, but works in Webrick.
In Apache, after pressing any button on page I got this page:

Exception in #: undefined method `call' for nil /home/radek/opt/ruby-1.8.0-=
2003.05.22/lib/ruby/site_ruby/1.8/borges/Renderer.rb:126:in `process_callba=
cks' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Re=
nderer.rb:126:in `each' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site=
_ruby/1.8/borges/Renderer.rb:126:in `process_callbacks' /home/radek/opt/rub=
y-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Renderer.rb:20:in `render_=
response' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borg=
es/Renderer.rb:6:in `render' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby=
/site_ruby/1.8/borges/Page.rb:31:in `response_loop' /home/radek/opt/ruby-1.=
8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Page.rb:31:in `loop' /home/rad=
ek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Page.rb:31:in `r=
esponse_loop' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/=
borges/Page.rb:24:in `go' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/si=
te_ruby/1.8/borges/Page.rb:24:in `callcc' /home/radek/opt/ruby-1.8.0-2003.0=
5.22/lib/ruby/site_ruby/1.8/borges/Page.rb:24:in `go' /home/radek/opt/ruby-=
1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Page.rb:16:in `call' /home/r=
adek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb:118=
:in `unknown_request' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_r=
uby/1.8/borges/Session.rb:108:in `handle_request_intern' /home/radek/opt/ru=
by-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb:101:in `callcc=
' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Sessi=
on.rb:110:in `handle_request_intern' /home/radek/opt/ruby-1.8.0-2003.05.22/=
lib/ruby/site_ruby/1.8/borges/Session.rb:43:in `initialize' /home/radek/opt=
/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb:42:in `sync=
hronize' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borge=
s/Session.rb:42:in `initialize' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/r=
uby/site_ruby/1.8/borges/Session.rb:41:in `loop' /home/radek/opt/ruby-1.8.0=
-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb:47:in `initialize' /ho=
me/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Session.rb=
:35:in `start' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8=
/borges/Session.rb:35:in `initialize' /home/radek/opt/ruby-1.8.0-2003.05.22=
/lib/ruby/site_ruby/1.8/borges/Application.rb:93:in `new' /home/radek/opt/r=
uby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/Application.rb:93:in `ne=
w_session' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/bor=
ges/Application.rb:83:in `handle_request' /home/radek/opt/ruby-1.8.0-2003.0=
5.22/lib/ruby/site_ruby/1.8/borges/Application.rb:43:in `handle_request' /h=
ome/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/borges/ApacheDRb=
Server.rb:30:in `handle_request' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/=
ruby/site_ruby/1.8/drb/drb.rb:688:in `__send__' /home/radek/opt/ruby-1.8.0-=
2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:688:in `perform_without_block'=
 /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:65=
2:in `perform' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8=
/drb/drb.rb:761:in `main_loop' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ru=
by/site_ruby/1.8/drb/drb.rb:757:in `loop' /home/radek/opt/ruby-1.8.0-2003.0=
5.22/lib/ruby/site_ruby/1.8/drb/drb.rb:775:in `main_loop' /home/radek/opt/r=
uby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:753:in `start' /home=
/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:753:in `=
main_loop' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb=
/drb.rb:599:in `run' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ru=
by/1.8/drb/drb.rb:596:in `start' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/=
ruby/site_ruby/1.8/drb/drb.rb:596:in `run' /home/radek/opt/ruby-1.8.0-2003.=
05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:549:in `initialize' /home/radek/opt=
/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:783:in `new' /home=
/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8/drb/drb.rb:783:in `=
start_service' /home/radek/opt/ruby-1.8.0-2003.05.22/lib/ruby/site_ruby/1.8=
/borges/ApacheDRbServer.rb:14:in `start' ./kontejner_srv.rb:11


The source is:
#!/usr/bin/env ruby
# $Header: /home/radek/cvs/mpress-kontejnery/kontejner.rb,v 1.1.1.1 2003/05=
/22 10:03:46 radek Exp $
# Datab=E1ze kontejner=F9 na barvu.
# Copyright (C) 2003 Radek Hnilica

require 'borges'
require 'borges/Page'
require 'dbi'
include Borges

class Kontejner < Page
    attr_reader :username

    def initialize
    end

    def render_on(r)
	r.table({'frame'=3D>'border', 'rules'=3D>'all'}) do
	    # Table headers
	    r.tr do
		r.print "<th>Kontejner</th><th>p=F8ijat</th>"
	    end
	    #render_table_buttons(r)
	    DBI.connect('DBI:pg:kontejner:localhost', 'kontejner', 'XXXXXXXX') do =
|dbh|
		dbh.select_all(<<-EndOfSQL
			       SELECT kontejner_id, prijato
			       FROM kontejner
			       ORDER BY kontejner_id;
			       EndOfSQL
			       ) do |row|
		    r.tr do
			id,pri =3D row
			r.print <<-EOF
			<td>#{id}</td>
			<td>#{pri}</td>
			EOF
			# Line Buttons
			r.td do
			    r.form do
				r.submit({'value'=3D>'Del'})
			    end
			end
		    end
		end
	    end
	    r.tr do
		r.form do
		    id =3D pri =3D nil
		    r.td{r.text_input(''){|id|}}
		    r.td{r.text_input(''){|pri|}}
		    r.td{r.submit({'value'=3D>'Add'}){}}
		end
	    end
	end
    end

    def render_line_buttons(r)
    end

    def render_table_buttons(r)
	r.tr do
	    r.form do
		id =3D pri =3D nil
		r.td{r.text_input(''){|id|}}
		r.td{r.text_input(''){|pri|}}
		r.td{r.submit({'value'=3D>'Add'}){add_kontejner(id,pri)}}
	    end
	end
    end

    def add_kontejner(id, pri)
	puts "add_kontejner(#{id}, #{pri})"
	#DBI.connect('DBI:pg:kontejner:localhost', 'kontejner',  'XXXXXXXX') do |d=
bh|
	#    dbh.do <<-EndOfSQL
	#    INSERT INTO kontejner (kontejner_id, prijato)
	#    VALUES ('#{id}', '#{pri}');
	#    EndOfSQL
	#end
    end
end

if $0 =3D=3D __FILE__ then
    require 'borges/Webrick'
    Borges::register_application("kontejner", Kontejner)
    Borges::WebrickConnection.start({:Port=3D>7777})
end

#Keep this comment at the end of the file
#Local variables:
#End:


It's based on code published on
http://www.penguin.cz/~radek/book/borges/index.html

The apache is 1.3.26-0woody3, ruby the latest from cvs so borges.

--=20
Radek Hnilica <Radek at Hnilica dot CZ>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
No matter how far down the wrong road you've gone, turn back.
						Turkish proverb



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+zMS904obroM0taURArx1AJ9qpq7rYbKA2NOh8pJCxAweu+vcvACgq21g
geXsEFYeGqfEKiu6nHAmhu0=
=LCwI
-----END PGP SIGNATURE-----