About perl closure.

About perl closure.

am 06.04.2008 05:59:26 von pswd

I have little idea about what are closures for perl?
Is it just a function maker that returns a reference of subroutine?

Could anybody tell me what it is and show me some examples?

Thanks in advance!

Re: About perl closure.

am 06.04.2008 06:27:42 von John Bokma

"pswd" wrote:

> I have little idea about what are closures for perl?
> Is it just a function maker that returns a reference of subroutine?
>
> Could anybody tell me what it is and show me some examples?

perldoc -q closure

--
John

http://johnbokma.com/perl/

Re: About perl closure.

am 07.04.2008 18:34:25 von xhoster

"pswd" wrote:
> I have little idea about what are closures for perl?
> Is it just a function maker that returns a reference of subroutine?

I think the thing that makes a code-ref a "closure" is that any
enclosing-scoped lexical variables appearing in them have their ref-counts
incremented, and thus can't be freed until after the closure itself is
destroyed.

>
> Could anybody tell me what it is and show me some examples?

try perldoc -q closure

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.