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

I have a graphical program that has lots of routines for menus, buttons, etc.

I want to put them in separate files...and include them together...--I am thinking in "c" here ;-)

I looked at:
Keywords related to perl modules
do, import, no, package, require, use

But none seemed right, as the code I want to separate is NOT generic (ie uses globals in main, etc.)

I just want to organize...any thoughts?

Do I have to create modules and export the functions and use Main:: infront of the variables??? I am looknig for somthing simple...

thanks!

Replies are listed 'Best First'.
Re: how to split large pl file
by ask (Pilgrim) on Nov 21, 2001 at 07:19 UTC
    But none seemed right, as the code I want to separate is NOT generic (ie uses globals in main, etc.)

    You really need to fix that, or any "organization" is just a waste of time.

    Try figuring out how you can divide up the work your program does in logical parts and then separate them out as modules.

    perldoc perlmod
    should be of help (Also available at perldoc.com).

     - ask

    -- 
    ask bjoern hansen, http://ask.netcetera.dk/   !try; do();
    
      Thanks Bjoern,

      but, I was kinda exagerating ;)

      I want to put all menu callbacks in a file and all button callbacks in another file...

        Something that's a menu callback can easily be made to be (possibly also) a button callback and vice-versa. (Not to mention pull-down menus.) This, IMO, means that these things are not inheritently different such that they should be seperated.
Re: how to split large pl file
by Hofmator (Curate) on Nov 21, 2001 at 15:49 UTC

    Reading in another file is simple: do 'filename.pl';

    see also do.

    But I'm not saying that I'd recommend this ... using modules is much cleaner.

    -- Hofmator