PDA

View Full Version : More Perl fun-CGI fun now.




digital1
May 18, 2006, 11:17 AM
:confused: I decided to start another thread. I actually got my problem solved from the last thread. I am trying to figure out how to do a drop-down in Perl using CGI.pm I can't find too many decent sources on doing this. Any ideas anyone?:confused:



hatter
May 29, 2006, 08:59 AM
Not really a mac question, so firstly I'd suggest looking at perlmonks.org for a great and helpful site for perl questions.

In answer to this specific question, the function you're looking for is
popup_menu() if you type 'perldoc CGI' in Terminal session, you'll find some examples, and the options available, but in essence it goes something like:

popup_menu(-name=>'color',-values=>['red','green','blue','chartreuse'], 'red')

epochblue
May 29, 2006, 09:38 AM
Not really a mac question, so firstly I'd suggest looking at perlmonks.org for a great and helpful site for perl questions.

In answer to this specific question, the function you're looking for is
popup_menu() if you type 'perldoc CGI' in Terminal session, you'll find some examples, and the options available, but in essence it goes something like:

popup_menu(-name=>'color',-values=>['red','green','blue','chartreuse'], 'red')


This is correct - but make sure you download and install the CGI CPAN module, and include it in your scripte/module with "use CGI;"

If you want perl to download an install the CPAN module itself, use this command (to be run from the command line):

perl -MCPAN -e 'install Module::Name'

Make sure you run it as root, and if it's the first time you've run this command, you'll have some setting up to do...the defaults are usually okay.

Oh - and that command is generic, your specific command will look like this:

perl -MCPAN -e 'install CGI';