• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How to hide/mask input w/perl?

NTB

Diamond Member
The old version of perl installed on the servers and my own PC at work doesn't include Term::ReadKey, unlike the more recent releases. Is there any other way to hide or mask input that I can use? I don't need anything fancy, just something that will show a "*" instead of the key that the user actually typed. Heck, even showing nothing would work.

Nathan
 
Have you tried to get the Term::ReadKey module from CPAN?

If you're on a Windows box, you're probably running ActiveState Perl, just bring up a DOS window and enter:

cpan

if it's the first time into CPAN, you're going to have to answer a bunch of setup questions, most of the time, you can just take the defaults. You will probably have to go to Microsoft and download "NMAKE"

Once you're through that, at the prompt, type in

install Term::ReadKey

and it will download and install it.

CPAN is how you update and extend Perl. Damn near anything you'd ever want to do with Perl has some modules on CPAN that'd make it much easier.

As far as masking your inputs, you can test for term type and colors, then set the text color to the same as the background. It's not very secure.

You can also redirect the stdout to null. Safer, but potentially really ugly if something/someone kills the session during the redirect.

Good luck

Scott


 
I haven't done this myself, but I don't see why you couldn't just install the Term::ReadKey package from CPAN. Even if you don't have permissions to install it for the server, you can manually download and install it to some local directory where you do have permissions and use it from there. I had to do this a lot last summer when I wrote Perl scripts using CPAN modules on a server for which I only had permissions to edit my home directory.
 
RE: Install Term::Key

This isn't for home, it's for work. Updating my workstation might not be a problem, but since my team does not 'own' any of the servers it uses, getting perl update on there could be a hassle.

Nathan
 
I'd say there is two ways to go about this. First, I would ask the owners of the server whether they are willing to install a Perl module for you. For example, my webhost will install Perl packages for me for free.

If they won't, then if you have shell access at all (e.g. via SSH), you can install the Perl package yourself in your home directory. Just follow the instructions at http://search.cpan.org/~jhi/pe...pod/perlmodinstall.pod
 
Back
Top