Dan Muey wrote: > > For instance: > > > > > > sub launch_viewer { > > my $for_path = shift; > > $message_viewer = create_main_viewer_window();
[snip pretty code IMHO] > > > create_view_menu(); > > create_find_menu(); > > } > > > > Nice Joseph, > > If I'm looking at this right this is a GUI for viewing files? > > What module(s) are you using before this code? Tk; ? Yes. > Or?? No modules of my own--as yet here. In fact, I must confess [*blushin real deep red here*] that this puppy has gotten to 1959 lines, all in one file. There are only 24 lines in the global namesspace, though, and only two actual variables. The other quasi-global variables are contained within the rather large--1000 line anonymous block holding the GUI code. There is no function that I cannot see in its entirelty in a single screen, though. Mostly this was a style example. I hope I wasn't too cryptic in my explanation. The idea was to show that you don't have to jump in to technical detail when you are describing a logical process, even in code. The functions I showed above were the organizational framework for the GUI building process, but that was just by way of example. The main concept here was to delegate detail. For instance, the create_view_menu(); command just tells you that the event is taking place, at the level of abstraction shown above. It is implemented: sub create_view_menu { my $message_viewer = shift; my $view_menu = $menu_bar->cascade ( -label => 'View', -tearoff => 0 ); my $menu_view_threads = $view_menu->command( -label => 'By Thread', -command => [\&mnu_thread_view]); my $menu_view_date = $view_menu->command( -label => 'By Date', -command => [\&mnu_date_view]); my $menu_view_sender = $view_menu->command( -label => 'By Sender', -command => [\&mnu_sender_view]); my $menu_view_subject = $view_menu->command( -label => 'By Subject', -command => [\&mnu_subject_view]); } elsewhere. Actually this function immediately follows the caller in my script.(;-o) There are some sorta srewy thigs in these snippets, related to global scoping. It's something I am still working on--how to contain these variable and still have them available to callbacks. Sooner or later this code will be restructured to hand the necessary references to the callbacks in an anonymous array. I have had mixed success with this approach, though. I'll ge there. > Or is this simply an example and "Not to be tried at home"? :) I would cetainly suggest applying the overall concept at hme, at work, at the coffeeshop [if you prefer a more social environment for your coding].. Just say what you want to do, plainly and simply, then make a few minor adjustments to turn it into code. > Thanks Oh. ...and have fun doing it. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>