in reply to Re: package sub and code reference
in thread package sub and code reference

Hi,
Thanks for nice enquiry.
I have to work the code, where already plent of coderefs are defined for different subroutine.
Now since, it's 'all in one' file I like to seperate it out and making more modular.
Another reason is to get rid of Global variables that each these subs are using.

Now if subs happens to belong a particular package and know that, my problem is solved.
I may require also a method to initialize the package and pass these 'currently globaled variables'.

Thanks,
Artist

Replies are listed 'Best First'.
Re: Re: Re: package sub and code reference
by dragonchild (Archbishop) on Sep 28, 2001 at 02:02 UTC
    I'm going to assume that this is using some sort of dispatch-table mechanism. If it's not, rip it apart and start over. Seriously.

    If it's using a dispatch, those globals may be appropriate. Globals aren't necessarily bad. In fact, in a dispatch-table setting, they can actually be very useful.

    If you're gung-ho about migrating these functions into a module, I'd look at rebuilding the dispatch with an OO context. How that would happen is very dependent on what exactly you're doing.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.