Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Drop-In Password Dialog?

by zentara (Archbishop)
on Nov 28, 2012 at 15:40 UTC ( #1006053=note: print w/ replies, xml ) Need Help??


in reply to Drop-In Password Dialog?

Any time you call a Tk script for example, your original script will continue to run after the MainLoop is destroyed. So you can just make your own little password popup like this:

#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow(); my $password = ''; my $entry = $mw->Entry( -show=>'*', -relief=>'ridge', -textvariable=>\$password )->pack; $entry->bind('<Return>',[\&somesub]); $entry->focus; # when the MainLoop is destroyed, the calling script can continue MainLoop; sub somesub { $password = $entry->get; print "password ->$password\n"; $mw->destroy; } print "you can continue on here\n"; <>; #wait for keypress to exit;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh


Comment on Re: Drop-In Password Dialog?
Download Code
Re^2: Drop-In Password Dialog?
by ColonelPanic (Friar) on Nov 29, 2012 at 06:32 UTC
    Thanks, this looks like it will be very helpful!


    When's the last time you used duct tape on a duct? --Larry Wall
Re^2: Drop-In Password Dialog?
by ColonelPanic (Friar) on Dec 03, 2012 at 15:07 UTC

    zentara, thanks again for this useful solution. I modified it slightly to also get a username, and it works great!



    When's the last time you used duct tape on a duct? --Larry Wall

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006053]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2014-07-29 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (226 votes), past polls