Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^6: Is 'use vars' really obsolete?

by perl-diddler (Chaplain)
on Sep 23, 2017 at 01:58 UTC ( [id://1199945]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Is 'use vars' really obsolete?
in thread Is 'use vars' really obsolete?

Did you catch the last line of my post:
No I have problems to parse the phrase structure, sorry.
No, I'm sorry! Thank you for your patience. Anyway, ignoring that -- I tried to "re-explain it" -- why using Exporter would be a problem. I probably could do something similar with the "export_to_level" ... but why? It seems like overkill to pull in Exporter to do what took 3-4 lines of code in my module -- just to get "away" from using "use vars".

On calling vars->import(List), do you mean in the program that's using the module? Where would var->import import things from? I.e. do you mean I'd do something like:

use Cmds qw(sudo dd); vars->import(Sudo Dd);
It seems cleaner to only specify the external cmd list once, but I'm not sure this is what you meant.

As for setting the stash -- probably could but that'd involve getting more into the internals of perl and I'd prefer to not do that, since the perl internals could easily change in a new release and then I'd have to fix my usage of it. More work! ARG! :-)

Why would I want to steer away from the eval? This is code that is usually only executed once at BEGIN time.

While I may not want to go back and change this module, I probably do want to go change some other modules I care about more, I'm still not clear why I'd prefer to get deeper into perl internals to get away from a "generic" eval? Most of my modules work back to 5.8 and some back to 5.6. I usually try to spend sometime to use less advanced methods so I can be compatible with older perls. Not always successful, but I still try.

-linda

Replies are listed 'Best First'.
Re^7: Is 'use vars' really obsolete?
by LanX (Saint) on Sep 23, 2017 at 11:21 UTC
    > On calling vars->import(List), do you mean in the program that's using the module? Where would var->import import things from?

    No you call it inside your import().

    at least that's what works with strict and warnings

    See Re: Code Reuse

    > since the perl internals could easily change in a new release

    That's extremely unlikely in this case, since it goes to the very foundations of Perl 4, symbol tables and strict.

    And if there was any kind of such change of internals, it would most likely imply killing use vars off, and you'd have more serious problems then.

    It's like the chance of the planet spontaneously swapping magnetic poles. ;)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      It's like the chance of the planet spontaneously swapping magnetic poles. ;)
      Which actually happens every half-million years or so. Just to put things in perspective.
        Anonmonk responded:
        It's like the chance of the planet spontaneously swapping magnetic poles. ;)

        Which actually happens every half-million years or so. Just to put things in perspective.


        Didn't I read that it was due or overdue any time now? *gulp*... To paraphrase a saying:

        Just because I'm paranoid doesn't mean the poles might not switch soon... ;^)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2024-03-29 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found