in reply to All uppercase subs

The risk can be mitigated by not using keywords (duh!). All keywords are listed in keywords.h, located somewhere within the filesystem. The only all upper case keywords in my keywords.h are:
#define KEY_NULL 0 #define KEY___FILE__ 1 #define KEY___LINE__ 2 #define KEY___PACKAGE__ 3 #define KEY___DATA__ 4 #define KEY___END__ 5 #define KEY_AUTOLOAD 6 #define KEY_BEGIN 7 #define KEY_CORE 8 #define KEY_DESTROY 9 #define KEY_END 10 #define KEY_INIT 11 #define KEY_CHECK 12

IIRC, diotalevi has a module that dynamically lists all keywords for the installed perl.

Update: B::Keywords looks like the module...

Replies are listed 'Best First'.
Re^2: All uppercase subs
by blazar (Canon) on Jul 18, 2005 at 14:12 UTC
    Thank you for your informative post. Though the point I was trying to make is that Perl has a long story of not-completely-backward-compatible changes and it is not so unreasonable to think of a hypothetic DEBUG specially named code block, although I bet that would ring a bell amongst p5l's developers. All in all I didn't say that was a problem, just reasoning on the issue. This is a meditation after all, isn't it?

    OTOH in your list I see

    #define KEY_NULL 0
    but that doesn't seem to make its way into Perl. I mean we do not have a NULL specially named block nor special token, have we?

    Also I don't see anything about CLONE (I've never used threads myself, BTW) in your excerpt from keywords.h. Maybe it's defined elsewhere...

      You are absolutely right, adding a DEBUG block would not be unreasonable, or even hard to imagine. Keywords could be added to perl (or any other language) willy-nilly, and there's not much we can do about it except get involved in the development process. We should thank Larry for giving us that option.

      Good catch, in that there are missing keywords in keywords.(pl|h). I wonder if it's an oversight or by design? Is it worthy of a post to the p5p mailing list?