On Nov 2, Paul Johnson said:
>{ my $a = "foo"; sub foo { sub { $a } } }
>{ my $a = "bar"; sub bar { $a; sub { $a } } }
Man, that still exists? Grumble. I ran into that a year or two ago. I
would have thought Perl 5.6 would have cleaned that out.
--
Jeff "japhy" Pinyan [EMAIL PROTEC
On Fri, Nov 02, 2001 at 03:41:02PM -0500, Jeff 'japhy' Pinyan wrote:
> On Nov 2, Paul Johnson said:
>
> >3. Currently, Perl exhibits some surprising behaviour in certain
> >situations when a named subroutine is being used as a closure. In
> >practice, Perl does not properly close named
On Nov 2, Paul Johnson said:
>> can be called a closure. I feel that "closure" refers more to the action,
>> and less to the means -- we are creating a subroutine (named or unnamed
>> makes no difference) which holds on to variables that "should" be gone.
First, I have to thank you for taking t
On Fri, Nov 02, 2001 at 10:51:49AM -0500, Jeff 'japhy' Pinyan wrote:
> On Nov 2, Etienne Marcotte said:
>
> >check out http://www.crusoe.net/~jeffp/articles/pm/2000-05.html
> >
> >a really good document on closures...
>
> Before I get a barrage of "BUT THAT'S NOT A CLOSURE!" let me say this. I
On Nov 2, Etienne Marcotte said:
>check out http://www.crusoe.net/~jeffp/articles/pm/2000-05.html
>
>a really good document on closures...
Before I get a barrage of "BUT THAT'S NOT A CLOSURE!" let me say this. I
was told that by someone (can't remember who), and I asked merlyn (Randal)
what he
check out http://www.crusoe.net/~jeffp/articles/pm/2000-05.html
a really good document on closures...
Etienne
Jenda Krynicky wrote:
> Original suggestion (comments stripped):
> > {
> > my $savedData = 0;
> >
> > sub rememberData
> > {
> > $savedData = shift if @_;# upda
Original suggestion (comments stripped):
> {
> my $savedData = 0;
>
> sub rememberData
> {
> $savedData = shift if @_;# update with new value if given
> return $savedData; # return current value
> }
> }
Curtis Poe <[EMAIL PROTECTED]> wrote:
> Actual
--- Jon Cassorla <[EMAIL PROTECTED]> wrote:
>
> There are many ways to do this. Here is just one example using a
> closure.
>
> package Remember;
>
> # this is a closure
> {
> my $savedData = 0;# only accessible within this scope; side
> effect is that
> # it
From: "Jon Cassorla" <[EMAIL PROTECTED]>
> There are many ways to do this. Here is just one example using a
> closure.
>
> package Remember;
>
> # this is a closure
> {
> my $savedData = 0;# only accessible within this scope;
>
> sub rememberData
> {
>
There are many ways to do this. Here is just one example using a
closure.
package Remember;
# this is a closure
{
my $savedData = 0;# only accessible within this scope; side
effect is that
# it stays around as long as the module since
the following
you can create a object or use clouses.
hope it helps
Martin
Rex Arul wrote:
> Friends,
>
> How can I persist values across method calls, without using Global
> Variables? IS there kind of "static" variables and if so can any of you
> provide a simple code example to prove the point?
>
> Thank
11 matches
Mail list logo