Skip Menu |

This queue is for tickets about the Tk-DBI-LoginDialog CPAN distribution.

Report information
The Basics
Id: 108406
Status: resolved
Estimated: 8 hours (480 min)
Worked: 8 hours (480 min)
Left: 4 hours (240 min)
Priority: 0/
Queue: Tk-DBI-LoginDialog

People
Owner: TMCMEEKI [...] cpan.org
Requestors: W-Kratzert [...] swissphone-systems.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.001
Fixed in: 1.005



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.
On Tue Nov 03 09:02:15 2015, W-Kratzert@swissphone-systems.de wrote: Show quoted text
> 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.
Hi Werner - thanks for the feedback. Your suggestions are good, and should be reasonably straightforward to incorporate. I will take a look at the "close" bug too.
Hi Werner, I have made the changes to this module for the bug, and your suggested enhancements 1, 3 & 4. I need to think on items 2 & 5 a bit more. If you want to test it, the latest version is at https://github.com/tmcmeeki/Tk-DBI-LoginDialog/blob/master/lib/Tk/DBI/LoginDialog.pm Regards, Tom On Tue Nov 03 09:02:15 2015, W-Kratzert@swissphone-systems.de wrote: Show quoted text
> 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.
Subject: AW: [rt.cpan.org #108406] Tk::DBI::Login - Pressing title bars' close button leads to warnings
Date: Sun, 21 Feb 2016 13:00:25 +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, sorry for the delay. But I fall ill for several weeks. I just begin to start my normal work and also do the tests. Thanks and regards Werner Swissphone Systems GmbH i. A. Werner Kratzert Produktmanagement Show quoted text
-----Ursprüngliche Nachricht----- Von: Tom McMeekin via RT [mailto:bug-Tk-DBI-LoginDialog@rt.cpan.org] Gesendet: Montag, 25. Januar 2016 16:17 An: Kratzert Werner Betreff: [rt.cpan.org #108406] Tk::DBI::Login - Pressing title bars' close button leads to warnings <URL: https://rt.cpan.org/Ticket/Display.html?id=108406 > Hi Werner, I have made the changes to this module for the bug, and your suggested enhancements 1, 3 & 4. I need to think on items 2 & 5 a bit more. If you want to test it, the latest version is at https://github.com/tmcmeeki/Tk-DBI-LoginDialog/blob/master/lib/Tk/DBI/LoginDialog.pm Regards, Tom On Tue Nov 03 09:02:15 2015, W-Kratzert@swissphone-systems.de wrote:
> 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.
Subject: AW: [rt.cpan.org #108406] Tk::DBI::Login - Pressing title bars' close button leads to warnings
Date: Sat, 27 Feb 2016 10:14:30 +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, I did some tests. The bug: Please call the &login method and press the 'x' to close the dialog. You first catch the problem with "# Bug #108406 fix for WM event" but "Use of uninitialized value $button in pattern match (m//) at Tk/DBI/LoginDialog.pm line 694." still appears. You may reproduce this $retry times. Then the dialog closes. I have problems with the warning line number (#694) - linux/windows? Therefore please use perl -e "use Tk;use Tk::DBI::LoginDialog;new MainWindow->LoginDialog( )->login( );MainLoop( );" to reproduce. Concerning my wishlist: 1. Works. 2. No problem to live with the feeling to be a thief. 3. I'm afraid my description was not precise enough. The idea was that you separate just the the DBI->connect in &cb_login and turn it to a public sub. This includes using the $data hash and set the $data->{'dbh'} attribute. Background: I start my application with cmdline options, fill in the GUI and the $data attributes and do the connect with the 1.005 &connect. Before pressing my application's Start button the user is now able to change the database using LoginDialog in the normal way. A sample GUI application is: I search a string inside a database and start with the database given by cmdline options. If I get no result then I want to search inside another database (normally with another driver). The idea was: my $d = $top->LoginDialog( -driver => $driverFromGetOption, -dsn => $dsnFromGetOption, ... ); my $dbh = $d->connect( ); #<==> $d->connect( ); my $dbh = $d-dbh( ); On the other hand I have a problem that you allow to create an endless number of $dbh with the same connect information. But this is my problem - not yours. Still: A &disconnect method or a dbh setter provided by you would help. If I had the choice: I'd prefer the &disconnect - It's LoginDialog's dbh not mine. At the moment I solve my problem by storing the current connect information. If I get a 'Login' and the connect data is unchanged I disconnect the new handle and set the $d->{'dbh'} to the old value. To do this I have to derive from the LoginDialog.pm (and introduced both the dbh setter and the disconnect method (disconnect and setting $d->dbh( ) to undef)). 4. Works. 5. Indeed: It's a bit dangerous to allow the GUI end user to set %attribs. And my example with Oracle's "sys as sysdba" should first be solved with Oracle permissions and not with LoginDialog.pm. Therefore I cancel 5b. But I'm still very interested in 5a. Thanks and kind regards and a nice weekend Werner Swissphone Systems GmbH i. A. Werner Kratzert Produktmanagement Show quoted text
-----Ursprüngliche Nachricht----- Von: Tom McMeekin via RT [mailto:bug-Tk-DBI-LoginDialog@rt.cpan.org] Gesendet: Montag, 25. Januar 2016 16:17 An: Kratzert Werner Betreff: [rt.cpan.org #108406] Tk::DBI::Login - Pressing title bars' close button leads to warnings <URL: https://rt.cpan.org/Ticket/Display.html?id=108406 > Hi Werner, I have made the changes to this module for the bug, and your suggested enhancements 1, 3 & 4. I need to think on items 2 & 5 a bit more. If you want to test it, the latest version is at https://github.com/tmcmeeki/Tk-DBI-LoginDialog/blob/master/lib/Tk/DBI/LoginDialog.pm Regards, Tom On Tue Nov 03 09:02:15 2015, W-Kratzert@swissphone-systems.de wrote:
> 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.
Okay, apologies for the long delay, but I've been busy with a new baby girl. Anyway, here is the summary... 1. Yes, I can replicate the closed bug whereby the $button variable is undefined. It turns out that i'd only half fixed it, so I corrected the code at #694. 2. I now allow the button text to be changed, which you can do by using the superclass (DialogBox) options "-buttons" and "-default_button". This causes me to have to refer to buttons in "cb_login" by then widget name, which I think is VERY DODGY, so I am not sure if I am really happy about that, but I will think about it for a while. 3. I have given you a disconnect() function which makes reference to the stored dbh, but you have to call it explicitly. Some discussion follows: In theory, I shouldn't keep the DBH in an internal struct, rather it should be maintained in the host program. The LoginDialog should be able to be called many times in the one program and return as many DBHs as the host program wants. If I was to keep track of all of them internally, then I would need a way of identifying them for the host program which is not particularly smart. I may consider removing the DBH attribute altogether. Anyway - can you test this version (which is on GitHub in the same location), and let me know what you think. Thanks & regards, Tom Show quoted text
> > > Swissphone Systems GmbH > > i. A. Werner Kratzert > Produktmanagement > > > -----Ursprüngliche Nachricht----- > Von: Tom McMeekin via RT [mailto:bug-Tk-DBI-LoginDialog@rt.cpan.org] > Gesendet: Montag, 25. Januar 2016 16:17 > An: Kratzert Werner > Betreff: [rt.cpan.org #108406] Tk::DBI::Login - Pressing title bars' > close button leads to warnings > > <URL: https://rt.cpan.org/Ticket/Display.html?id=108406 > > > Hi Werner, I have made the changes to this module for the bug, and > your suggested enhancements 1, 3 & 4. I need to think on items 2 & 5 > a bit more. > If you want to test it, the latest version is at > https://github.com/tmcmeeki/Tk-DBI- > LoginDialog/blob/master/lib/Tk/DBI/LoginDialog.pm > Regards, > Tom > > On Tue Nov 03 09:02:15 2015, W-Kratzert@swissphone-systems.de wrote:
> > 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.
> > >
Subject: AW: [rt.cpan.org #108406] Tk::DBI::Login - Pressing title bars' close button leads to warnings
Date: Wed, 2 Nov 2016 13:31:41 +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, thanks a lot for your answer. Even if there is no reason to apologize a new baby girl would be one of course. Congratulations! I tested the new version - here are my comments. 1. The bug is fixed. One question: Why do I have to push the 'x' three ($retry) times to close the LoginDialog? Shouldn't the 'x' behave like the Cancel-Button? 2. Inspecting your code I can see what you mean with "VERY DODGY". I just forgot how the DialogBox works when I asked for the ability to translate the Buttons' texts. Based on your solution I just stored the "$args->{-buttons} array" in $self->privateData (). So "if( $button eq $data->{'ButtonsAvailable'}->[0] )" the Cancel button was pressed, if it's the 1st element, the Login button was pressed, .... Nearly the same as you did in "sub_button" but I think it's a bit less dodgy. (I hope that I didn't forget big things as I did with forgetting how the DialogBox works.) The storage is done in "sub Populate": my @buttons_available = $args->{-buttons}; $self->SUPER::Populate($args); # before calling Populate $args->{-buttons} are available after calling they are no more available. my $attribute = $self->privateData; %$attribute = ( buttons_available => @buttons, In the end I hope you will become happy with the translation feature. 3. Meanwhile I think my problem is that you created a module to produce (may be a lot) of $dbh with one dialog. And I test different databases (Oracle, MariaSQL, SQLServer, SQlite, ...) with the same scenarios. So I want all other dialog entries unchanged and just change the database connection and press the Start button again. Up to now I found workarounds as you see in "my" "sub Show". So I will close my wish list now but please leave the DBH affairs unchanged. Thanks & regards, Werner Swissphone Systems GmbH i. A. Werner Kratzert Produktmanagement Show quoted text
-----Ursprüngliche Nachricht----- Von: Tom McMeekin via RT [mailto:bug-Tk-DBI-LoginDialog@rt.cpan.org] Gesendet: Donnerstag, 6. Oktober 2016 13:52 An: Kratzert Werner <W-Kratzert@swissphone-systems.de> Betreff: [rt.cpan.org #108406] Tk::DBI::Login - Pressing title bars' close button leads to warnings <URL: https://rt.cpan.org/Ticket/Display.html?id=108406 > Okay, apologies for the long delay, but I've been busy with a new baby girl. Anyway, here is the summary... 1. Yes, I can replicate the closed bug whereby the $button variable is undefined. It turns out that i'd only half fixed it, so I corrected the code at #694. 2. I now allow the button text to be changed, which you can do by using the superclass (DialogBox) options "-buttons" and "-default_button". This causes me to have to refer to buttons in "cb_login" by then widget name, which I think is VERY DODGY, so I am not sure if I am really happy about that, but I will think about it for a while. 3. I have given you a disconnect() function which makes reference to the stored dbh, but you have to call it explicitly. Some discussion follows: In theory, I shouldn't keep the DBH in an internal struct, rather it should be maintained in the host program. The LoginDialog should be able to be called many times in the one program and return as many DBHs as the host program wants. If I was to keep track of all of them internally, then I would need a way of identifying them for the host program which is not particularly smart. I may consider removing the DBH attribute altogether. Anyway - can you test this version (which is on GitHub in the same location), and let me know what you think. Thanks & regards, Tom
> > > Swissphone Systems GmbH > > i. A. Werner Kratzert > Produktmanagement > > > -----Ursprüngliche Nachricht----- > Von: Tom McMeekin via RT [mailto:bug-Tk-DBI-LoginDialog@rt.cpan.org] > Gesendet: Montag, 25. Januar 2016 16:17 > An: Kratzert Werner > Betreff: [rt.cpan.org #108406] Tk::DBI::Login - Pressing title bars' > close button leads to warnings > > <URL: https://rt.cpan.org/Ticket/Display.html?id=108406 > > > Hi Werner, I have made the changes to this module for the bug, and > your suggested enhancements 1, 3 & 4. I need to think on items 2 & 5 > a bit more. > If you want to test it, the latest version is at > https://github.com/tmcmeeki/Tk-DBI- > LoginDialog/blob/master/lib/Tk/DBI/LoginDialog.pm > Regards, > Tom > > On Tue Nov 03 09:02:15 2015, W-Kratzert@swissphone-systems.de wrote:
> > 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.
> > >