>* The $SETTINGS global hash ref isn't documented anywhere and could
>probably be passed to the various subs instead. Globals config variables
>has always bitten me sooner or later in the past :/
Point taken - in this case, it's part of the much larger AmphetaDesk
project (at http://www.disobey.com/amphetadesk/), where it's documented in
the main program file (amphetadesk.pl).
Generically speaking, in my scripts, I use $CAPITALS for variables that are
global to the whole program, and then small's for variables that should
remain in the library or package.
>* In open_url:
> use Win32::API;
> my $ShellExecute = new Win32::API("shell32", "ShellExecuteA",
>['N','P', 'P', 'P', 'P', 'I'], 'N');
>
>I would create the API object once at compile time (outside the sub) and
>check for success (or die("something")). That way you will have a safe
>state when the application starts--no surprises in the middle of everything
>you have to recover from.
Ah. Point taken, and a good one. I'll fix this in a later release.
>* What does
>
> $logbox->SendMessage(0x301,0,0);
>
>mean? You won't remember in two weeks either. Encapsulate in a generic and
>well-named sub that gives away what it is doing. Beats a comment any day
>(not that you shouldn't document the sub :)
In this case, I'm thinking that the sub name is fine:
sub _EditCopy_Click
The fact that it's the Copy command from the Edit menu, and that the user
has "Click"ed on it, and that's the only line in the routine works good
enough to tell me that "this esoteric command means to copy whatever's
selected).
>* sub _OpenWindow_Click {
>
>What happens if open_url takes a long time and the user double clicks? Set
>the "$already_called = 1;" immediately after checking it, making it as
>atomic as possible.
Hmm. I wonder if that had anything to do with some of the slowdown I
experienced before. I'll be sure to check into that. More questions:
- do you see any Window related handles that I've missed?
I'd much rather define every single possible event than miss
some and hope that the code figures it out. Does my code
always bring the Window to the top (in practice, sometimes
it does, sometimes it doesn't)?
--
Morbus Iff ( .sig on other machine. )
http://www.disobey.com/ && http://www.gamegrene.com/
"where's there's a will, there's a morbus ready to collect!"