package TkLogon; use Milkbone::Logon; use Milkbone; use strict; use warnings; my $mw = hook("tk_getmain"); my $logged = 0; register_hook("create_logon_prompt", sub { my $log = $mw->MBLogon; $log->init($mw); register_hook("signed_in", sub { Milkbone::Logon::on_signed_in($ARGS{-self}); $logged = 1; } , {-self => $log}); register_hook("protocol_signoff", sub { return unless $ARGS{-fatal}; my ($self) = $ARGS{-self}; return if $logged; $self->on_cancel; }, {-self => $log}); }); 1;