On Wed, Dec 10, 2014 at 3:21 PM, Uri Guttman <u...@stemsystems.com> wrote:

> the way to do that is to modify @_ in the calling routine and then calling
> the sub with &. in your case it would be
>
>     unshift @_, 'my: ' ;
>     &foo ;
>

Hadn't thought of that, or, rather, the "my:" was added later to try and
show it was my call of warn, not the system.


> but you are calling warn there which may not work that way as it is
> builtin.
>

It is, apparently different.  Looked at perldoc for perlipc and
perlwarnings and tried
    &warn;
    &warn();
    &warnings::warn();
use warnings::register;
    &warnings::warnif;

 all of which failed for various reasons.

> for an example of &foo being used in real world code, see the source of
> File::Slurp. the error handling code is called with & from several places.
>

the win there isn't just sharing the code but the return from the error
> handler goes back to the user's caller and not to a sub in the module.
>

Yes, that would be useful too.  I must have forgot that aspect of "&" calls
;->


-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

Reply via email to