How to add browse button in perl

I need a code snippet to add browse button for my perl UI, please let me know where can I find the module, how can I install that module, and if anybody can give me an example it will be really appreciated.

Thanks,

-Ashutosh
ashutoshg2006Asked:
Who is Participating?
 
Adam314Commented:
What library are you using for your UI?

If you are using Tk:
my $browsebutton = $mw->Button(-text=>"Browse")->pack();
0
 
ashutoshg2006Author Commented:
Hi Adam,
    Thanks for your reply, please also suggest how do you implement the functionality of browse button, I mean go to the directory and get the file name.

Thanks,

-Ashutosh
0
 
Adam314Commented:
There are several Tk widgets that provide a file select...

use Tk;
use Tk::FBox;
use Tk::FileSelect;

my $mw=new MainWindow;

my $button =$mw->Button(-text=>"Browse with FBox", -command=>sub {$mw->FBox()->Show;})->pack();
my $button2=$mw->Button(-text=>"Browse with FileSelect", -command=>sub {$mw->FileSelect()->Show();})->pack();
my $button3=$mw->Button(-text=>"Browse with getOpenFile", -command=>sub {$mw->getOpenFile();})->pack();

MainLoop();
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
TintinCommented:
Are you using Tk, or are you asking for suggestions as to which UI to use?
0
 
ashutoshg2006Author Commented:
I am using Tk
0
 
Adam314Commented:
The short script I gave will create a window with three buttons.  You can click each button, and you will get a file select box.  Each button uses a different widget to create the file select box.
I'm guessing there are more than the three shown - but those three are part of the standard installation.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.