The objectification of the items in the packages is _desirable_, but I haven't gotten to the point of figuring out what things I want to "objectify".
It's a case of I first developed a "script" (if you can call something around 500+ lines 'a script' :-)) -- that started as "hacks" (my first GUI using Tk; hope to convert to native Win32 if/when I get things properly abstracted and objectified). So your advice to restructure using objects is desirable, though possibly premature -- I'm trying to "evolve" the program toward something more modular and clean. Starting from an example that displays a single "picture", I've been evolving/modifying the program from there.
From the large glob of "prog" I have now, I want to move to objects where it makes sense, but first I want to "conceptually" break apart "functions" by putting groups of functions into separate packages.
Perhaps unrealistically idealistic, I'd like to be able to accomplish:
where instead of putting the code for "moda" and "modb" in separate files, I can include it "inline". Ideally, I'd like to use the standard "Export" type functions within the defined packages, to somehow specify the functions I want to use as interface functions....prog... use moda; use modb; ....
I notice you are using the "*func=\&mypackage::func" notation to import specific names from the packages. Is there anyway to do that using the standard "Exporter" and "@Exports=" functionality? I.e. pretty much as if I literally copied a normal "package" into my file -- maintains its own namespace, but uses "Exports" to define the exported interface.
If it is not possible, at least I could use "manual" mode of "exporting" my functions from the packages into the main symbol table via the "*func=..." construct. Seemingly not as elegant as using the standard "Exporter" functions, but perhaps the best alternative.
Thanks for the suggestions...at least I can use the above temporarily until I find something better...:-)
In reply to Re^2: multiple "sub" packages in 1 file: possible? how?
by perl-diddler
in thread multiple "sub" packages in 1 file: possible? how?
by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |