Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

A Perl developer will often encounter Perl code that uses deprecated features. Is there a place where depricated features and functions in Perl are documented?

For example, horror of horrors, while auditing existing applications I often encounter the use of dynamic scoping. "When I see local used on a dynamic variable, I pull out my revolver."

On one dynamically scoped module they use what looks like a builtin called uselocal which I've never seen but which I can guess at. As in uselocal "Some::Module"; It looks like the beast of dynamic scoping got up and started to walk, it's so frightening. I don't have access yet to the entire app just this frightening script they've sent so I'll thank you if you tell me it's just a bad dream, that they've written a mimicked builtin with protos. Or tell me you've seen it before and it dropped out of perldoc -f range.

Replies are listed 'Best First'.
Re: Depricated Features of the Language
by extremely (Priest) on Oct 18, 2000 at 07:06 UTC

    local isn't deprecated, just misunderstood. =) I have seen occasional calls for a stronger -w that warns of working but deprecated code but I've never seen how it could do more than annoy...

    As to documentation, I suppose perldoc perldelta is your best first stop, where to after that is a little fuzzy to me too. =)

    --
    $you = new YOU;
    honk() if $you->love(perl)

Re: Depricated Features of the Language
by turnstep (Parson) on Oct 18, 2000 at 07:48 UTC

    Keep in mind that the word "deprecated" does not necesarily mean "old, to-be-avoided feature." This topic has been beaten to death not just once but twice :)

    As for finding deprecated things in code, strict and the -w flag do a prety good job of flagging things outside of the norm (assuming that you have an updated version of perl, of course!)

Re: Depricated Features of the Language
by AgentM (Curate) on Oct 18, 2000 at 07:13 UTC
    Unfortunately, there is no central place for such situations. Newer version of modules usually describe their backwards compatibilty vars and funcs in their pod, as in CGI, where it descibes interoperability with cgi-lib.pl, or DBI, where certain variables have become simply meaningless. I guess the only solution then is to scan the pod of the module you plan to use and take the author's advice- most likely he knows best what he had in mind when he wrote the module.
    AgentM Systems nor Nasca Enterprises nor Bone::Easy is responsible for the comments made by AgentM.
Re: Depricated Features of the Language
by Anonymous Monk on Oct 18, 2000 at 07:52 UTC
    Dynamic scoping is seriously deprecated in my book. The reference here is not to local $/ = undef; or somesuch but to dynamic scoping, which is very scary. Don't always assume that a module author knows what he is doing. In this case it is a legacy app, not a CPAN module.

    I've seen some scary code out there that uses local in all the wrong ways. That is what I'm talking about! hint: you won't see use strict in their code anywhere.

    It gives Perl a bad name

    So, has anyone seen uselocal "Some::Module";?

      So, has anyone seen uselocal "Some::Module";?

      IIRC it's part of InterShop, the ecommerce package and it doesn't actually do anything with scoping, it's just a function that they include which adds their module libraries to @INC before using the module.

      Been some time since I used it tho' so I could be misremembering.

      --
      <http://www.dave.org.uk>

      "Perl makes the fun jobs fun
      and the boring jobs bearable" - me

        Yes,

        That's it! I'm going to get into the app tomorrow. Whoever wrote these extensions sure used dynamic scoping, plug in whatever big name publicly traded consulting firm you choose, tsk, tsk!

        And these are the same people who are pushing Java! No wonder, their Perl is so wretched. Thanks for quelling my bad dream.

        "what if a demon were come into your dream and whisper into your ear that every thing you've lived you'll have to relive again and again" -apologies to nietzsche