| | |
Form data as input into Perl code
![]() |
•
•
Join Date: May 2006
Posts: 36
Reputation:
Solved Threads: 5
Try using the CGI module. It makes doing CGI development in Perl extremely easy (at least the CGI bits).
Try this at a command line:
Try this at a command line:
Perl Syntax (Toggle Plain Text)
perldoc CGI
•
•
Join Date: Jan 2005
Posts: 18
Reputation:
Solved Threads: 2
A simple example... (note: more validation should be done, this is just an example...)
// a basic html form
// the perl script (script.pl)
me!
// a basic html form
Perl Syntax (Toggle Plain Text)
<form action='script.pl' method='post'> NAME: <input type='text' name='name' size'8' maxlength='8' /> <br /> <input type='submit' name='button' value='Folder Name' /> </form>
// the perl script (script.pl)
Perl Syntax (Toggle Plain Text)
#! /usr/lib/perl use CGI; use strict; my $obj = new CGI; my $name = $obj->param ( 'name' ); my $base = './docs/folders/'; print "Content-type: text/html\n\n"; if ( $name eq '' ) { print "the directory name was not entered!\n"; } elsif ( $name !~ m/^[a-z0-9]{1,8}$/i ) { print "the directory name was not valid!\n"; } else { if ( -e $base . $name ) { print "can not create directory, directory already exists!\n"; } elsif ( ! mkdir ( $base . $name, 0777 ) ) { print "can not create directory\n"; } else { print "new directory created\n"; } } exit(0);
me!
![]() |
Similar Threads
- CGI, Tomcat, Perl, not compiling Perl code? (Perl)
- Form data & Back button (PHP)
- Need help for conveting Perl Code to a C Code (Perl)
- email form problem (Web Hosting Deals)
- can some one make me a simple perl code (Perl)
- help with my perl code (Perl)
Other Threads in the Perl Forum
- Previous Thread: Executing Server Applications remotely
- Next Thread: GUI of desktop applications
| Thread Tools | Search this Thread |





