in reply to package sub and code reference

First off, I'm going to ask why you want to do this. The reason I'm asking is that taking coderefs within other packages falls under the "I need to justify this before I do it" category. Maybe there's another, easier way that'll accomplish what you want to do...

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

Replies are listed 'Best First'.
Re: Re: package sub and code reference
by artist (Parson) on Sep 28, 2001 at 01:37 UTC
    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

      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.