From: keinlezard Date: 2011-05-18T05:40:33+09:00 Subject: need help with "module" and variable hello My problem is I have this code in a file > > module DB_parc > Toto=2 > def DB_parc::session() > begin > dbh = DBI.connect(CONF_parc::Db,CONF_parc::User,CONF_parc::Password); > #backend = Backend.new(dbh) > #yield(backend) > # yield :provoque l'execution de la variable pass�e en parametre > yield(dbh) > rescue DBI::Error => e > puts "#{e.errstr}" > ensure > dbh.disconnect if dbh > end > end > end And in another file I have something like > DB_parc.session{|dbh| > schema="sparc" > .... } I try to get the dbh handler because I need to write a function that use it ... may be I'm wrong and it exits another way to do this My funtion is something like that def List(some parameters) query_tab_mater="select id, label from sparc.type_materiel order by label asc" sth=dbh.execute(query_tab_mater) sth.fetch{|k,v| output+="