Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: Howto "use" backward compability packages of new "feature"s

by LanX (Saint)
on Aug 23, 2010 at 14:40 UTC ( [id://856720]=note: print w/replies, xml ) Need Help??


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

Thanks a lot for the "stricter" example, the possibility to import pragmas is owesome.

Do you know where this is documented?

BTW: just found an "if pragma" which could be used for backwards compatibility!

  use if $] < 5.008, "utf8";

Cheers Rolf

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

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

    just found an "if pragma" which could be used for backwards compatibility!

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

      > 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

        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;.

Re^5: Howto "use" backward compability packages of new "feature"s
by JavaFan (Canon) on Aug 25, 2010 at 09:52 UTC
    just found an "if pragma" which could be used for backwards compatibility!
    Ah, but if.pm has backwards compatability issues itself - it first appeared in 5.6.2 Here's what I use if I want to use warnings, but still want the code to be able to run in 5.005 (without warnings enabled of course):
    BEGIN { $INC{"warnings.pm"} = 1 if $] < 5.006; } use strict; use warnings;
    Note that if you want to be able to do no warnings, you have to create a dummy sub warnings::unimport as well.

    I've no reason to assume if.pm cannot be installed in 5.005. I just don't want another module dependency for what I can do in a single statement myself.

      Thanx, very interesting. :)

      I'm quite enthusiastic about requiring and importing pragmas in a separate module like demonstrated in this example of use stricter

      Could you do me a favor and test it in your suite of old perl interpreters?

      I'm still not completely convinced...

      Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://856720]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-18 12:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found