Subject: | Tk::DBI::Login - Pressing title bars' close button leads to warnings |
Date: | Tue, 3 Nov 2015 14:01:37 +0000 |
To: | "bug-Tk-DBI-LoginDialog [...] rt.cpan.org" <bug-Tk-DBI-LoginDialog [...] rt.cpan.org> |
From: | Kratzert Werner <W-Kratzert [...] swissphone-systems.de> |
Hi Tom,
first: Great to meet someone who handles with Tk (and uses another geometry manager than pack) and handles with databases and e.g. Log4net. I'm not new to Perl but learned a lot from your code especially things concerning heritage. Thanks.
As you see above I'm sure I found a bug in your module. "Pressing title bars' close button leads to warnings".
I'm using
Activestate Perl (v5.16.2) built for MSWin32-x86-multi-t Binary build 1602 [296513] provided by ActiveState
Activestate Perl (v5.20.2) built for MSWin32-x86-multi-t Binary build 2002 [299195] provided by ActiveState
Tk::DBI::LoginDialog V1.004
Windows 7, 8.1, 10
Pressing close button it calls \&cb_login with undefined $button. All following statement using $button will produce a warning even the 'others' branch while logging the error.
Also the statement in \&login "last if (defined $self->dbh || $button =~ "Cancel");last if (defined $self->dbh || $button =~ "Cancel");" is affected.
Would be nice to solve this one day.
I don't know whether this is the right place for some suggestions - if not I hope you apologize...
1. Would be great to advertise the Label-s as well as the Entry-s! Reasons:
a. I am german and would like to translate the label's -text. (I'm aware I will have some problems translating Tk::Dialog's buttons and Show's return values). A mapping possibility would be great.
b. In special cases I want to disable e.g. the "driver" option. I am able to formForget the BrowseEntry-s but not the according Label-s. The result looks crazy. (Never worked with the form manager before.)
2. I disabled the Exit button using "subwidget->'B_Exit'->packForget". (I don't want that the child is able to kill it's father.) But I feel like a thief working with 'B_Exit'. Present a method?
3. Making the login functionality of 'Login' button in \&cb_login pulic by providing a separate method/sub. Reasons:
a. I want to run my Tk script(s) as well in "silent" mode using command line options. At the moment I have to offer the same login functionality in my code that you already implemented.
b. And / or: allow dbh method to work as setter. That's my workaround at the moment. I think it's better having one place where the information is stored. And the place should be in Tk:DBI::LoginDialog I think.
4. \&login returns undef in both cases whether 'Cancel' was pressed or the 'Login' failed. To stay compatible a method to get the button value pressed would be great.
5. Allow an influence on DBI->connect's %attrib. Reasons:
a. From my view there's no need for PrintError. The information is already displayed in ROText widget and available via the error method.
b. E.g.: Driver is Oracle and I want to connect as sysdba. A way to do this is (thanks to http://www.perlmonks.org/?node_id=786017 and others):
use DBD::Oracle qw(:ora_session_modes);
my $dbh = DBI->connect
( "dbi:Oracle:...", "SYS", "...",
{ ora_session_mode => ORA_SYSDBA, PrintError => 0, RaiseError => 1 }
);
Of course I might set the attributes after connecting - but if the connect fails it's too late and logging in as Oracle's sysdba is impossible.
At the moment I'm working with a derived widget using Show rather than login method. Solves most of my problems with exception of the not advertised labels (see 1.a., 1.b.).
Thanks for your patience!
Kind regards
Werner.