in reply to RFC : Pragma vs. Module

Using a pragma-style name without actually being a pragma is severely frowned on by many people. To make a pragma, you need to convince p5p that your change belongs in the core of perl, and get it added to the standard library and mentioned in the docs. If you don't do all of that, it's just a module, and it should be named appropriately.

Don't just take my word for it. If you take a look at some of the modules with pragma-style names on CPAN, you will see some pretty harsh reviews.

Replies are listed 'Best First'.
Re: RFC : Pragma vs. Module
by Abigail-II (Bishop) on Mar 14, 2004 at 17:25 UTC
    Using a pragma-style name without actually being a pragma is severely frowned on by many people.
    But what is a pragma? If it's a module that fiddles with $^H, and "pragma-style" names means a name in lowercase, then there are many "violations", including in the Perl core. (constant.pm for instance).

    Abigail

Re: Re: RFC : Pragma vs. Module
by etcshadow (Priest) on Mar 14, 2004 at 21:36 UTC
    Look at lib.pm. It's a "pragma", but all it's doing is manipulating @INC in a pretty straight-forward way, and it's pure-perl, too.

    Anyway, I just mean that what is meant by "pragma" is open for a certain degree of interpretation.

    ------------ :Wq Not an editor command: Wq
      ...I just mean that what is meant by "pragma" is open for a certain degree of interpretation.

      I agree:

      Mind you, none of these modules are registered, so I'm really avoiding the issue...

      Liz

        Well, in my opinion, these should not be named as if they were pragmas, since pragmas are included in the core and documented in the perl man pages. Not a slight on the functionality of these useful modules; just a disagreement about naming etiquette.
      I don't understand your point. The 'lib' pragma is part of the core library and is listed in perltoc. That's exactly what I was saying needs to happen to create a pragma. I didn't say anything about implementation language.
Re: Re: RFC : Pragma vs. Module
by ysth (Canon) on Mar 14, 2004 at 17:40 UTC
    That's kind of ambiguous. It's not what the module does that would be a problem (though some people would only call a pragma something with lexical scope that has a compile-time effect); it's the use of lower case. Top-level lower case names are reserved for use by perl5-porters.
      Yes, the naming is what I was talking about. Sorry if that wasn't clear.
Re: Re: RFC : Pragma vs. Module
by stvn (Monsignor) on Mar 15, 2004 at 02:17 UTC

    I hear what you are saying, especially regarding naming. It makes sense that the p5p would want to keep that to themselves.

    Personally, I have always thought of pragmas as being "hints" for the compiler, in its simplest definition. (At least that is what pragmas are in Ada95, which is where i first learned about them.) But being that Perl has such a richer interface to its compiler, I suppose I had extended that definition to also include anything that messes around with symbol tables during any of the compiliation phases. Maybe my definition is too broad, as these things would be better thought of as macros/pre-processors rather than pragmas.

    -stvn