Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Re: Clearing user defined variables

by Wassercrats
on Apr 13, 2004 at 10:41 UTC ( #344677=note: print w/replies, xml ) Need Help??

in reply to Re: Clearing user defined variables
in thread Clearing user defined variables

Such a subroutine would be longer than my hack because of the number of variables. I'd need to use my hack (or B::Xref) to determine all the variables anyway. I don't have all my variables memorized, and I'm not sure which ones need to be reset for my new implementation so it's not so easy to implement some of the suggestions I've gotten. I didn't anticipate using the script in such a way, or else I would have cleared all the variables in the proper places as I created them.

There are a few ways to deal with this, and it's no big deal in my case, but something needs to be done about reset.

...still have to look into PodMasters __PACKAGE__ idea.

I have 14 subroutines.
  • Comment on Re: Re: Clearing user defined variables

Replies are listed 'Best First'.
Re: Re: Re: Clearing user defined variables
by castaway (Parson) on Apr 13, 2004 at 11:27 UTC
    If you dont know which ones, then find out? Else all you have is a mess, if you cant keep track of which variables you're using where. Of course it would be long, its just an alternative to the scoped variables you probably should be using. Globals arent so bad if you know exactly whats being used where and how, and make a note/comment about it somewhere. If you dont, well, throw the thing in the bitbuecket and start again :)


      I have plenty of notes and comments, but 3200 is alot of lines to review. I have a big block of comments in the beginning, but they don't cover every detail. Still, I'm considering spending a little time trying to determine which variables need to be emptied, and risking having a bug. I have an idea which ones, but I don't think I'll take a chance.

      Anyway, some uses of the script could produce a 1MB variable at the end that wouldn't cause problems if not emptied before the next use, but it probably should be.

      The only other languages I ever knew were BASIC and Assembly, neither of which had local variables, and BASIC had... clr or something.

        At least the CPUs that I am familiar with, the Z80 and the x86, both had local variables in the stack, and I've used them to quite some extent in assembly language.

        Personally, I believe you will be far better off by throwing your current 14-sub 3200-line script away and reimplement it as separate files. merlyn is always eager to offer code review, both public and private, and there is also the code review ladder mailing list, that also will do a Perl code review for you.

        Go there, show them your code, and in the process of explaining the code to them, you will find valuable practices to keep and valuable changes to implement.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://344677]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2018-04-24 05:30 GMT
Find Nodes?
    Voting Booth?