CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Parameter Validation

 



tdeuel1
Deleted

Mar 3, 2001, 7:41 PM

Post #1 of 1 (479 views)
Parameter Validation Can't Post

I have a program that I have to modify and I'm a novice to Perl. This program used to validate 2 parameters and if incorrect, would print an 'Incorrect parameters -- please contact source page's author' error message. The program would pass a constant variable of either 'CompanyA' or 'CompanyB' and a number string. I need to modify the program to pass 5 parameters with the following attributes: param(1) is a constant - either 'CompanyA' or 'CompanyB'; param(2) is a constant - will always be 'DWG'; param(3) is a variable and is enclosed in single quotes, it's a drawing number and can consist of a) all letters, b) all numbers, c) a combination of letters and numbers, or d) a combination of letters, numbers and a space (examples: '108E1111', '1234567', 'DWG A' ); param(4) is a variable and is enclosed in single quotes, it's a vendor and can consist of a) all letters, b) letters with a dash, c) letters with a + sign or an ampersand(&) (examples: 'ATT', 'M+M', 'M&M', 'MM-M' ); param(5) is a variable and is enclosed in single quotes, it's a revision number, is always 2 characters in length and can consist of a) letters, b) numbers, c) a dash, d) a space (examples: ' -', ' A', '12', 'AB' ).

This is the code that I need to modify from my old Perl script:

my $param = (keys %in)[0];
if ($param !~ /^CompanyA [0-9]+$/ && $param !~ /^CompanyB [0-9]+$/) {
print &CompanyStandardHtmlHeader("ProgramTNG - Incorrect Parameters ($ENV{'HTTP_WEBNAME'})");
print "<H2>Incorrect parameters -- please contact source page's author</H2>;
print &CompanyStandardHtmlFooter( );
exit;
}

Any assistance you can give me will be greatly appreciated. Thank you.


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives