Re: my OR our that is the question ?!

2001-08-10 Thread Honza Pazdziora
On Fri, Aug 10, 2001 at 12:22:43AM +0300, raptor wrote: thanx, Yes I see ... but I was interested WHY when we are in nested subroutines ... the inner-one will see the lexical var only the first time !! I mean the Note that there are _no_ nested subroutines in Perl. You may declare one inside

Re: my OR our that is the question ?!

2001-08-10 Thread raptor
Note that there are _no_ nested subroutines in Perl ..So what you basicaly have are two global subroutines with local values. You get the closure for the first invocation. But it's not the same variable anymore. ]- Now understand thanx alot = iVAN [EMAIL PROTECTED] =

my OR our that is the question ?!

2001-08-09 Thread raptor
hi, I have the following situation ... it is not big issue but i'm interested why this happen .. so here is it : my $ID = 555; print $ID; sub blah { .. { local $$dbh{AutoCommit} = 0; eval { local $$dbh{RaiseError} = 1; $ID = selectrow

Re: my OR our that is the question ?!

2001-08-09 Thread Andrew Ho
Hello, rI have the following situation... it is not big issue but ri'm interested why this happen... r rmy $ID = 555; rsub blah { r... r$ID = selectrow query; r... r} This is, in fact, a big issue. You should see a message in your error log shared variable

Re: my OR our that is the question ?!

2001-08-09 Thread Jim Smith
On Thu, Aug 09, 2001 at 01:36:28PM -0700, Andrew Ho wrote: Hello, rI have the following situation... it is not big issue but ri'm interested why this happen... r rmy $ID = 555; rsub blah { r... r$ID = selectrow query; r... r} This is, in fact, a

Re: my OR our that is the question ?!

2001-08-09 Thread raptor
thanx, Yes I see ... but I was interested WHY when we are in nested subroutines ... the inner-one will see the lexical var only the first time !! I mean the REASON of this perl behaviour ! It it closer/easier to think of it that my-vars are visible all the time in their inner scopes (except if u

Re: my OR our that is the question ?!

2001-08-09 Thread Perrin Harkins
So what is the REASON for this copy-on-first-call behaviour.(there have to be some reason, if i'm not totaly dull to see it ) It's called a closure. You can read up on it in the Camel book or in Damian Conway's OO book. - Perrin

Re: my OR our that is the question ?!

2001-08-09 Thread raptor
didn't thought of that :)), but what will broke if the var is copied/aliased every time not just the first time ... I mean the call to closure make a new instance of the sub() every time isn't it ?!? ! I see the closures get bound every-time , but non closures only the first time ! But

OT: Re: my OR our that is the question ?!

2001-08-09 Thread James Smith
On Fri, Aug 10, 2001 at 01:08:12AM +0300, raptor wrote: didn't thought of that :)), but what will broke if the var is copied/aliased every time not just the first time ... I mean the call to closure make a new instance of the sub() every time isn't it ?!? ! I see the closures get

Re: my OR our that is the question ?!

2001-08-09 Thread Stas Bekman
On Thu, 9 Aug 2001, Perrin Harkins wrote: So what is the REASON for this copy-on-first-call behaviour.(there have to be some reason, if i'm not totaly dull to see it ) It's called a closure. You can read up on it in the Camel book or in Damian Conway's OO book. oh even here: