Need help with "module" and variable

hello

My problem is

I have this code in a file

On Wed, May 18, 2011 at 06:57:59AM +0900, 7stud – wrote:

Don’t use global variables–ever.

From what I’ve seen, whenever someone uses a global variable, it’s
because the person washaving difficulty figuring out how to get data
from
one scope into another (and sometimes back again). It’s true that using
global variables is pretty much never the right answer, if for no other
reason than the fact it can cause issues if there are two globals with
the same name.

So, yeah, yours is decent advice. There’s just one problem: when people
say “don’t use globals” and leave it at that, they give the people who
used globals no ideas what other recourse they have available to them.
Don’t just say “don’t use global variables”. Try saying “You could do
this other thing instead, to get what you need without using a global
variable.”

Le 17/05/2011 23:57, 7stud – a écrit :

Don’t use global variables–ever.

I understand that … what I want to know…

Is how make that without this damned global variables …

It seems to me that my code do not use global variable …

I meet this kid of problem when I try to write

    }

end

output+=funct(sth)

to replace

I know that an horrible code … in fact that is just another test …
that produce same problem than my other chunk of code …

On May 17, 2011, at 4:40 PM, keinlezard wrote:

                  puts "#{e.errstr}"
     sth.fetch{|k,v|
                   output+="<option value='#{v}'"
                   type_materiel = 'non-connu'
                   if v == type_materiel
                           output+= " selected='selected'"
                   end
                   output+= ">#{v}</option>"
               }
    output+= "</select></td></tr> "

end

make sure your definition of List includes a parameter for the dbh
handle:

def List(dbh, other, parameters)
# stuff
end

Now use something like this:

DB_parc.session { |dbh|
schema=“sparc”
List(dbh, schema, other, stuff)
}

Gary W.

keinlezard wrote in post #999948:

Le 17/05/2011 23:57, 7stud – a écrit :

Don’t use global variables–ever.

I understand that … what I want to know…

You posted no code in your first post, nor did you post a question.

In your second post, you posted no code and then you asked a question
about your invisible code.

Do you really expect any relevant help?

Le 20/05/2011 22:35, 7stud – a écrit :

talking about.

That is curious … because … I post with code …
Problem with your provider / News reader / or something else … I
suppose …

greetings

On Sat, May 21, 2011 at 05:35:24AM +0900, 7stud – wrote:

keinlezard wrote in post #999948:

Le 17/05/2011 23:57, 7stud – a crit :

Don’t use global variables–ever.

I understand that … what I want to know…

You posted no code in your first post, and you posted no code in your
next post. So no one has any idea what your questions is or what you are
talking about.

Is there something wrong with your mail user agent? I saw code. This
is
an excerpt from the original message:

  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
> passe en parametre
> yield(dbh)
> rescue DBI::Error => e
> puts “#{e.errstr}”
> ensure
> dbh.disconnect if dbh
> end
> end
>end

I’m not sure why he has blockquote characters at the beginnings of all
those lines of code, but that’s definitely code – and it’s not all the
code that was in that message, either.