automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 50-use-strict.patch


From: Russ Allbery
Subject: Re: 50-use-strict.patch
Date: 19 Mar 2001 01:16:26 -0800
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Akim Demaille <address@hidden> writes:

> I don't know how to fix the `use strict refs' part.  In particular, it
> dies on computed sub names:

>       & $my_sub ();

> fails, and I don't know how to rewrite it the way strict refs wants it.

You can't.  You have to do something like:

    { no strict 'refs'; &$my_sub(); }

(no strict is lexically scoped).  Preventing you from doing that is the
point of use strict 'refs', since computed subs like that are considered
to be an advanced feature and a mistake more often than intentional.  :)

(If you want to rewrite the code, you can use a hash of sub refs instead
of the computed name method, but that isn't always any cleaner or more
readable.)

-- 
Russ Allbery (address@hidden)             <http://www.eyrie.org/~eagle/>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]