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.
In reply to Re^2: how to declare a local *subname=sub{}?
by perl-diddler
in thread how to declare a local *subname=sub{}?
by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |