in reply to Re^5: Howto "use" backward compability packages of new "feature"s
in thread Howto "use" backward compability packages of new "feature"s

> Where what is documented, the run-time equivalent of use? In use.

Well it's documented for "MODULE"s, but is it evident that it's possible to call an "import" method on a pragma?

There is no builtin "import" function.

Hmm at least it's consistent, which is brilliant! :)

>You found it at the top of the post to which you replied.

nonsense, I oversaw it there! ;)

Cheers Rolf

  • Comment on Re^6: Howto "use" backward compability packages of new "feature"s

Replies are listed 'Best First'.
Re^7: Howto "use" backward compability packages of new "feature"s
by ikegami (Patriarch) on Aug 25, 2010 at 01:24 UTC

    Well it's documented for "MODULE"s

    Yes, and if you look right above, all the usage modes of use are use Module ...; except for use VERISON;.

      and if you look further down pragmas are called "pseudo-modules".

      I will open a ticket to add the "use stricter" example to the perldoc.

      UPDATE:

      pragmas are not even mentioned in require, it only talks about "library files" and do/eval file mechanisms.

      Otherwise, require demands that a library file be included if it hasn't already been included. The file is included via the do-FILE mechanism, which is essentially just a variety of eval with the caveat that lexical variables in the invoking script will be invisible to the included code. Has semantics similar to the following subroutine: ...

      Cheers Rolf

        You are saying there's some undocumented usage for pragmas. That's not true. use strict; matches the use Module; pattern, which is documented to be the same as BEGIN { require strict; strict->import(); }.

        Anyway, pragmas refers to modules that behave in a certain fashion. There's nothing special about them as far as Perl is concerned.

        pragmas are not even mentioned in require, it only talks about "library files"

        First you complain that "Modul"e is too specific, now you complained that the more generic term doesn't apply.

        pragmas are not even mentioned in require
        Note that pragmas don't exist on the language level. That is, Perl (the language) doesn't treat modules whose name is all lowercase different from modules who do not. "Pragmas" (or as some people call them "pragmata") are a loosly defined concept; typically as 'modules that influence the compilation process in some way'. But any module that exports prototyped subroutines influences compilation. And so do source filters. Many people consider "constant.pm" to be a pragma, but all it does is export subs with an empty prototype. But Fcntl and POSIX do so as well.

        Perhaps one could consider modules that set parts of @H and %H to be pragmas.