>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]
=
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 insid
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:
http:
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 ge
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
> 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
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
On Thu, Aug 09, 2001 at 01:36:28PM -0700, Andrew Ho wrote:
> Hello,
>
> r>I have the following situation... it is not big issue but
> r>i'm interested why this happen...
> r>
> r>my $ID = 555;
> r>sub blah {
> r>...
> r>$ID = selectrow query;
> r>...
> r>}
>
Hello,
r>I have the following situation... it is not big issue but
r>i'm interested why this happen...
r>
r>my $ID = 555;
r>sub 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 v
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 query;#s
10 matches
Mail list logo