in reply to Re: how to declare a local *subname=sub{}?
in thread how to declare a local *subname=sub{}?
1) Why does including the "local *asub" prevent it from being called in "stuff"? I.e. if you uncomment the "local *asub" line, it can't be called in "stuff" -- this is the main question.
2) Why does including the "local *bsub" (of an interior function -- different animal) appear to be ignored in "sub stuff".
In playing w/the test case, I noted that I could put the "local *'subname', outside of an interior sub where it is implemented -- but that doing so was "ignored", from-the-standpoint of trying to call it from "outside" its containing sub (i.e. the attempted call to &bsub in "stuff()". That curiosity created question#2...
Note, I wouldn't expect calling an interior function (as stuff tries to call bsub) to necessarily work -- just that I found that trying to pre-declare it with local didn't even change the error message when "stuff" tried to call it. I thought that was strange.
Main Q is why or how might I _declare_ asub, or is
*asub = sub{...} equivalent to
sub asub {}?
It's that I'm not used to seeing an undeclared name on the LeftHandSide without it being flagged by "strict" as it not being declared.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: how to declare a local *subname=sub{}?
by LanX (Saint) on Oct 30, 2016 at 23:12 UTC | |
by perl-diddler (Chaplain) on Oct 31, 2016 at 12:00 UTC | |
|
Re^3: how to declare a local *subname=sub{}?
by LanX (Saint) on Oct 30, 2016 at 23:23 UTC | |
by perl-diddler (Chaplain) on Oct 30, 2016 at 23:31 UTC | |
by LanX (Saint) on Oct 30, 2016 at 23:41 UTC | |
|
Re^3: how to declare a local *subname=sub{}?
by LanX (Saint) on Oct 30, 2016 at 23:05 UTC | |
by perl-diddler (Chaplain) on Oct 31, 2016 at 11:57 UTC | |
by LanX (Saint) on Oct 31, 2016 at 12:35 UTC | |
|
Re^3: how to declare a local *subname=sub{}?
by LanX (Saint) on Oct 30, 2016 at 23:37 UTC |