By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

how to check for all the fields in user registrations perl script

100+
P: 236
Hi All,

I modified the user registration script, but not sure how to make it check for each variable in terms of preventing junk registration and invalid characters?
Two codes below :
a) html
b) perl script (print and inserting into database)

Cheers...
Andrew

a) html
=====
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//SoftQuad//DTD HTML 3.2 + extensions for HoTMetaL PRO 3.0(U) 19961211//EN"
  2.  "hmpro3.dtd">
  3. <HTML>
  4. <HEAD>
  5. <TITLE></TITLE></HEAD>
  6. <BODY>
  7. <FORM ACTION="/cgi-bin/acctman2.pl" METHOD="POST">
  8. <CENTER>
  9. <TABLE BORDER="0" WIDTH="400">
  10. <TR>
  11. <TD ALIGN="CENTER">
  12. <TABLE BORDER="0" CELLPADDING="5" BGCOLOR="#FF8000">
  13. <TR>
  14. <TD><INPUT TYPE="CHECKBOX" NAME="agree" VALUE="agree"></TD>
  15. <TD><FONT SIZE="-1" FACE="verdana, arial, helvetica"><B>I agree to the Terms 
  16. and Conditions above.</B></FONT></TD></TR></TABLE><BR></TD></TR>
  17. <TR>
  18. <TD>
  19. <HR SIZE="2" NOSHADE="NOSHADE"></TD></TR>
  20. <TR>
  21. <TD ALIGN="CENTER">
  22. <TABLE BORDER="0" WIDTH="350" NOWRAP="NOWRAP">
  23. <TR>
  24. <TD><FONT SIZE="-1" FACE="verdana, arial, helvetica"><B>Customer Information</B></FONT><BR><FONT
  25. SIZE="-2" FACE="verdana, arial, helvetica" COLOR="#FF0000"><B>Fields marked 
  26. with an asterisk<BR>are required input fields.</B></FONT><BR><BR></TD></TR>
  27. <TR>
  28. <TD><INPUT TYPE="TEXT" NAME="fname">
  29. <FONT SIZE="-1" FACE="verdana, arial, helvetica">First Name *</FONT></TD></TR>
  30. <TR>
  31. <TD><INPUT TYPE="TEXT" NAME="lname">
  32. <FONT SIZE="-1" FACE="verdana, arial, helvetica">Last Name *</FONT></TD></TR>
  33. <TR>
  34. <TD><INPUT TYPE="TEXT" NAME="email">
  35. <FONT SIZE="-1" FACE="verdana, arial, helvetica">E-Mail Address *</FONT></TD></TR></TABLE>
  36. <TABLE BORDER="0" WIDTH="350" NOWRAP="NOWRAP">
  37. <TR>
  38. <TD><BR><FONT SIZE="-1" FACE="verdana, arial, helvetica"><B>Choose a User 
  39. Name</B></FONT><BR><INPUT TYPE="TEXT" NAME="username"> 
  40. <FONT SIZE="-1" FACE="verdana, arial, helvetica">User Name</FONT>  
  41. <FONT SIZE="-1" FACE="arial, helvetica"><BR><BR><B>Choose a Password</B></FONT><BR>
  42.  
  43. <INPUT TYPE="password" NAME="pwd">     
  44. <FONT SIZE="-1" FACE="verdana, arial, helvetica">Password</FONT><BR><INPUT
  45. TYPE="password" NAME="pwd2"> <FONT SIZE="-1" FACE="verdana, arial, helvetica">Verify
  46.   Password</FONT></TD></TR></TABLE><BR><BR><INPUT
  47. TYPE="SUBMIT" NAME="process" VALUE="Submit My Order"><INPUT
  48. TYPE="RESET" NAME=""></TD></TR>
  49. <TR>
  50. <TD>
  51. <HR SIZE="2" NOSHADE="NOSHADE"></TD></TR></TABLE></CENTER></FORM></BODY></HTML>
  52.  

b) perl script
=========
Expand|Select|Wrap|Line Numbers
  1. #!c:\perl\bin\perl.exe 
  2. #!/usr/bin/perl 
  3. ############################################ 
  4. ##                                        ## 
  5. ##     Account Manager LITE User Signup   ## 
  6. ##          by SiteInteractive.com        ## 
  7. ##    http://siteinteractive.com/contact  ## 
  8. ##                                        ## 
  9. ##             version:  1.09             ## 
  10. ##       last modified:  07/24/2002       ## 
  11. ##        copyright (c) 1998 - 2002       ## 
  12. ##                                        ## 
  13. ##    latest version is available from    ## 
  14. ##        http://SiteInteractive.com      ## 
  15. ##                                        ## 
  16. ############################################ 
  17. # Copyright 1998 Elite Host.  All Rights Reserved. 
  18. # TERMS OF USE  
  19. # 1. Account Manager is for licensed customers 
  20. # only. Customer may use Account Manager as many 
  21. # times as customer wishes, as long as customer owns or runs the web 
  22. # site that Account Manager is installed on.  Account 
  23. # Manager may not under any circumstances be sold 
  24. # or redistributed without the written consent of CGI Script Center and 
  25. # its owner Diran Alemshah. 
  26. # 2. CGI Script Center, at its own discresion, will decide if any terms  
  27. # of the this agreement have been violated by customer. Upon written e- 
  28. # mailed notification to Customer of Terms of Use violations, CGI 
  29. # Script Center may revoke customer's license to use Account Manager. 
  30. # In that event, Customer agrees to any and all of the following: 
  31. # a) Customers found in violation of this agreement, found reselling or 
  32. # redistributing Account Manager, or making  
  33. # Customers Members Area ID and password public to anyone in any  
  34. # manner will forfeit their Members area password and all rights to  
  35. # future versions of Account Manager. 
  36. #  
  37. # b). Customer will no longer be licensed to run any version of  
  38. # Account Manager.  
  39. # Indemnification 
  40. # 1. Customer agrees that it shall defend, indemnify, save and hold 
  41. # CGI Script Center, Elite Web Design and marketing, and any 
  42. # persons affiliated with either company, harmless from any and all 
  43. # demands, liabilities, losses, costs and claims, including reasonable 
  44. # attorney's fees asserted against CGI Script Center, its agents, its 
  45. # customers, officers and employees, that may arise or result from any 
  46. # service provided or performed or agreed to be performed or any product 
  47. # sold by customer, its agents, employees or assigns. Customer agrees to 
  48. # defend, indemnify and hold harmless CGI Script Center, its agents, 
  49. # its cusomters, officers, and employes,against 
  50. # liabilities arising out of; a) any injury to person or property caused 
  51. # by an products sold or  otherwise distributed in connection with CGI 
  52. # Script Center products; (b) any material supplied by customer 
  53. # infringing or allegedly infringing on the proprietary rights of a 
  54. # third party; c) copyright infringement and (d) any defective products 
  55. # sold to customer from CGI Script Center products. 
  56. # This program may not be distributed in whole or part, freely, for pay,  
  57. # or any other form of compensation. 
  58. ##################################################  ############### 
  59. # This version designed for Win32 systems (NT).  If you require 
  60. # a Unix version, please contact cgi@elitehost.com 
  61. ##################################################  ############### 
  62.  
  63.  
  64. ##################################################  ############ 
  65. # EDIT USER CONFIGURATIONS BELOW 
  66. ##################################################  ############ 
  67.  
  68. # apache is in d DRIVE!!! not C
  69.  
  70. #require "d:/program files/apache software foundation/apache2.2/cgi-bin/config.pl"; 
  71.  
  72. # This completes this portion of your Account Manager setup 
  73. ##################################################  ############ 
  74. # DO NOT EDIT BELOW THIS LINE 
  75. ##################################################  ############ 
  76.  
  77. use CGI; 
  78. use CGI::Carp qw(fatalsToBrowser); 
  79. use DBD::mysql;
  80. use DBI;
  81.  
  82. my $query = CGI->new; 
  83.  
  84. unless ($CGI::VERSION >= 2.47) {  
  85.    error('Your version of CGI.pm is too old. You must have verison 2.47 or higher to use this script.') 
  86.  
  87.  
  88. #SECTION B
  89. #=========================================
  90. #Database initialization and initial query
  91. my ($dbh, $data_source);  
  92. my $mysql_server_name   = 'localhost';  
  93. my $mysql_database_name = 'test';  
  94. my $mysql_user_name     = 'root';  
  95. my $mysql_password      = 'mysql1';  
  96.  
  97. my $data_source = 'DBI:mysql:' . $mysql_database_name . ':' . $mysql_server_name;  
  98. my $dbh = DBI->connect( $data_source, $mysql_user_name, $mysql_password, {RaiseError=>1}) ||  die "$DBI::errstr";   
  99.  
  100.  
  101.  
  102.  
  103. #important line to pass email address from html to perl
  104. my $agree_field = $query->param("agree") || 'Annonymous'; 
  105. my $first_name = $query->param("fname") || 'Annonymous'; 
  106. my $last_name = $query->param("lname") || 'Annonymous'; 
  107. my $email_address = $query->param("email") || 'Annonymous'; 
  108. my $user_name = $query->param("username") || 'Annonymous'; 
  109. my $password = $query->param("pwd") || 'Annonymous'; 
  110.  
  111.  
  112. # End of Database initial Query
  113. #==========================================
  114.  
  115. print $query->header(), 
  116.       $query->start_html(-title=>'Input Successful'), 
  117.       $query->p('Thanks for registrating your particulars with us!'), 
  118.       $query->p("You Agree? : $agree_field:"),
  119.       $query->p("Your First Name : $first_name"),
  120.       $query->p("Your last Name : $last_name"), 
  121.       $query->p("Your email address: $email_address"), 
  122.       $query->p("Your username : $user_name"), 
  123.       $query->p("Your Password : $password"), 
  124.       $query->end_html; 
  125.  
  126. sub error { 
  127.    print $query->header(), 
  128.          $query->start_html(-title=>'Error'), 
  129.          shift, 
  130.          $query->end_html; 
  131.    exit(0); 
  132.  
  133.  
  134. my $sql = $dbh->prepare(qq{SELECT * FROM user_reg}); 
  135.    $sql->execute(); 
  136.  
  137. while (my @data = $sql->fetchrow_array()) { 
  138.  
  139.       # Print the date from the first two columns in the table 
  140.       #print $data[0], "\t", $data[1], "<br>"; 
  141.        print $data[0], "\t", $data[1], "\t", $data[2], "\t", $data[3], "\t", $data[4], "\t", $data[5], "<br>";  
  142.  
  143. 1;
  144.  
  145.  
  146.  $sql = $dbh->prepare(qq{insert into user_reg(agree_field, first_name, last_name, email_address, user_name, password) values ( "$agree_field", "$first_name", "$last_name", "$email_address", "$user_name", "$password") } );  
  147.    $sql->execute() or die "$dbh->errstr\n";;  
  148.  
  149. $sql = $dbh->prepare(qq{SELECT * FROM user_reg});  
  150.  $sql->execute(); 
  151.  
  152.  
  153. while (my @data = $sql->fetchrow_array()){  
  154.  
  155.       # Print the date from the first four columns in the table  
  156.       print $data[0], "\t", $data[1], "\t", $data[2], "\t", $data[3], "\t", $data[4], "\t", $data[5], "<br>";  
  157.  
  158. }
  159. 1;
  160.  
  161.  
Oct 20 '08 #1
Share this Question
Share on Google+
82 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
As far as checking the input information, you won't be able to really prevent "junk" information, but you will instead want to check the format of what has been entered. ie: Check that the email address is in the correct format. Check that where you expected two numbers, two numbers were entered, etc. Check that fields where things were to be selected (either by check boxes, radio buttons or dropdowns), that a selection or selections were made.

For the valid email address, you could do as many sites to and send a verification email that they need to respond to in an appropriate manner to get verified and complete registration.

How you do it is up to you, but it all depends on how anal you want to be about your data.

Regards,

Jeff
Oct 20 '08 #2

KevinADC
Expert 2.5K+
P: 4,059
For an email address I recommend you use the Email::Valid module. For the rest of your form fileds its hard to say, only you can define what "preventing junk registration and invalid characters" means to you and your particular requirements.

The general method is to use regular exressions to evaluate the form field data

Expand|Select|Wrap|Line Numbers
  1. if ($data =~ /\W/) {
  2.     $data has at least one non-word character so we consider it bad
  3. }
  4.  
So the first thing you do is determine what your form field data should be then you write some code that tests those assumptions. If a form field should only be digits:

Expand|Select|Wrap|Line Numbers
  1. if ($var =~ /\D/) {
  2.    bad.. it has a non digit somewhere
  3. }
  4. if ($var =~ /^\d+$/) {
  5.    good... digits beginning to end (this is better validation than above)
  6. }
  7.  
Oct 20 '08 #3

eWish
Expert 100+
P: 971
I would suggest that you look at CPAN for a module to help you if you are not good with regular expressions.

FormValidator::Simple
Data::FormValidator


--Kevin
Oct 20 '08 #4

100+
P: 236
Hi Kevin,

Thanks. Is there any reference site to show what is the details and how to call and interface to the modules you recommended.?


Cheers...
Andrew
Oct 21 '08 #5

KevinADC
Expert 2.5K+
P: 4,059
Hi Kevin,

Thanks. Is there any reference site to show what is the details and how to call and interface to the modules you recommended.?


Cheers...
Andrew
Click on the links and read the documentation.
Oct 21 '08 #6

100+
P: 236
Click on the links and read the documentation.
Hi Kevin,

Understand, I read the documentation but still dont understand it.

Is there any step by step reference sites and any examples? Or I just cut and paste certain segment to integrate to my existing scripts. Or I just package it into a module and try to incorporate into perl package manager?

Appreciate your kind enlightenment.


Cheers...
Andrew
Oct 22 '08 #7

100+
P: 236
Hi Kevin / All,

I managed to try out email::valid package to check if the email address is valid from the directed website of your recommendation, but it seemed that the perl package manager always got this error when I tried to install the package.

And html error gave below and the script is pasted below.

Kindly enlighten what can be done...


Cheers...
Andrew

html error
=======
Software error:
Can't locate Email/Valid.pm in @INC (@INC contains: C:/perl/site/lib C:/perl/lib .) at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/acctman2.pl line 88.
BEGIN failed--compilation aborted at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/acctman2.pl line 88.

For help, please send mail to the webmaster (admin@gateway.2wire.net), giving this error message and the time and date of the error.


latest perl script(added use email::valid package, see last 2 lines)
====================================
Expand|Select|Wrap|Line Numbers
  1.  
  2. #!c:\perl\bin\perl.exe 
  3. #!/usr/bin/perl 
  4. ############################################ 
  5. ##                                        ## 
  6. ##     Account Manager LITE User Signup   ## 
  7. ##          by SiteInteractive.com        ## 
  8. ##    http://siteinteractive.com/contact  ## 
  9. ##                                        ## 
  10. ##             version:  1.09             ## 
  11. ##       last modified:  07/24/2002       ## 
  12. ##        copyright (c) 1998 - 2002       ## 
  13. ##                                        ## 
  14. ##    latest version is available from    ## 
  15. ##        http://SiteInteractive.com      ## 
  16. ##                                        ## 
  17. ############################################ 
  18. # Copyright 1998 Elite Host.  All Rights Reserved. 
  19. # TERMS OF USE  
  20. # 1. Account Manager is for licensed customers 
  21. # only. Customer may use Account Manager as many 
  22. # times as customer wishes, as long as customer owns or runs the web 
  23. # site that Account Manager is installed on.  Account 
  24. # Manager may not under any circumstances be sold 
  25. # or redistributed without the written consent of CGI Script Center and 
  26. # its owner Diran Alemshah. 
  27. # 2. CGI Script Center, at its own discresion, will decide if any terms  
  28. # of the this agreement have been violated by customer. Upon written e- 
  29. # mailed notification to Customer of Terms of Use violations, CGI 
  30. # Script Center may revoke customer's license to use Account Manager. 
  31. # In that event, Customer agrees to any and all of the following: 
  32. # a) Customers found in violation of this agreement, found reselling or 
  33. # redistributing Account Manager, or making  
  34. # Customers Members Area ID and password public to anyone in any  
  35. # manner will forfeit their Members area password and all rights to  
  36. # future versions of Account Manager. 
  37. #  
  38. # b). Customer will no longer be licensed to run any version of  
  39. # Account Manager.  
  40. # Indemnification 
  41. # 1. Customer agrees that it shall defend, indemnify, save and hold 
  42. # CGI Script Center, Elite Web Design and marketing, and any 
  43. # persons affiliated with either company, harmless from any and all 
  44. # demands, liabilities, losses, costs and claims, including reasonable 
  45. # attorney's fees asserted against CGI Script Center, its agents, its 
  46. # customers, officers and employees, that may arise or result from any 
  47. # service provided or performed or agreed to be performed or any product 
  48. # sold by customer, its agents, employees or assigns. Customer agrees to 
  49. # defend, indemnify and hold harmless CGI Script Center, its agents, 
  50. # its cusomters, officers, and employes,against 
  51. # liabilities arising out of; a) any injury to person or property caused 
  52. # by an products sold or  otherwise distributed in connection with CGI 
  53. # Script Center products; (b) any material supplied by customer 
  54. # infringing or allegedly infringing on the proprietary rights of a 
  55. # third party; c) copyright infringement and (d) any defective products 
  56. # sold to customer from CGI Script Center products. 
  57. # This program may not be distributed in whole or part, freely, for pay,  
  58. # or any other form of compensation. 
  59. ##################################################  ############### 
  60. # This version designed for Win32 systems (NT).  If you require 
  61. # a Unix version, please contact cgi@elitehost.com 
  62. ##################################################  ############### 
  63.  
  64.  
  65. ##################################################  ############ 
  66. # EDIT USER CONFIGURATIONS BELOW 
  67. ##################################################  ############ 
  68.  
  69. # apache is in d DRIVE!!! not C
  70.  
  71. #require "d:/program files/apache software foundation/apache2.2/cgi-bin/config.pl"; 
  72.  
  73. # This completes this portion of your Account Manager setup 
  74. ##################################################  ############ 
  75. # DO NOT EDIT BELOW THIS LINE 
  76. ##################################################  ############ 
  77.  
  78. use CGI; 
  79. use CGI::Carp qw(fatalsToBrowser); 
  80. use DBD::mysql;
  81. use DBI;
  82. use Email::Valid;
  83.  
  84.  
  85. my $query = CGI->new; 
  86.  
  87. unless ($CGI::VERSION >= 2.47) {  
  88.    error('Your version of CGI.pm is too old. You must have verison 2.47 or higher to use this script.') 
  89.  
  90.  
  91. #SECTION B
  92. #=========================================
  93. #Database initialization and initial query
  94. my ($dbh, $data_source);  
  95. my $mysql_server_name   = 'localhost';  
  96. my $mysql_database_name = 'test';  
  97. my $mysql_user_name     = 'root';  
  98. my $mysql_password      = 'mysql1';  
  99.  
  100. my $data_source = 'DBI:mysql:' . $mysql_database_name . ':' . $mysql_server_name;  
  101. my $dbh = DBI->connect( $data_source, $mysql_user_name, $mysql_password, {RaiseError=>1}) ||  die "$DBI::errstr";   
  102.  
  103.  
  104.  
  105.  
  106. #important line to pass email address from html to perl
  107. my $agree_field = $query->param("agree") || 'Annonymous'; 
  108. my $first_name = $query->param("fname") || 'Annonymous'; 
  109. my $last_name = $query->param("lname") || 'Annonymous'; 
  110. my $email_address = $query->param("email") || 'Annonymous'; 
  111. my $user_name = $query->param("username") || 'Annonymous'; 
  112. my $password = $query->param("pwd") || 'Annonymous'; 
  113.  
  114.  
  115. # End of Database initial Query
  116. #==========================================
  117.  
  118. print $query->header(), 
  119.       $query->start_html(-title=>'Input Successful'), 
  120.       $query->p('Thanks for registrating your particulars with us!'), 
  121.       $query->p("You Agree? : $agree_field:"),
  122.       $query->p("Your First Name : $first_name"),
  123.       $query->p("Your last Name : $last_name"), 
  124.       $query->p("Your email address: $email_address"), 
  125.       $query->p("Your username : $user_name"), 
  126.       $query->p("Your Password : $password"), 
  127.       $query->end_html; 
  128.  
  129. sub error { 
  130.    print $query->header(), 
  131.          $query->start_html(-title=>'Error'), 
  132.          shift, 
  133.          $query->end_html; 
  134.    exit(0); 
  135.  
  136.  
  137. my $sql = $dbh->prepare(qq{SELECT * FROM user_reg}); 
  138.    $sql->execute(); 
  139.  
  140. while (my @data = $sql->fetchrow_array()) { 
  141.  
  142.       # Print the date from the first two columns in the table 
  143.       #print $data[0], "\t", $data[1], "<br>"; 
  144.        print $data[0], "\t", $data[1], "\t", $data[2], "\t", $data[3], "\t", $data[4], "\t", $data[5], "<br>";  
  145.  
  146. 1;
  147.  
  148.  
  149.  $sql = $dbh->prepare(qq{insert into user_reg(agree_field, first_name, last_name, email_address, user_name, password) values ( "$agree_field", "$first_name", "$last_name", "$email_address", "$user_name", "$password") } );  
  150.    $sql->execute() or die "$dbh->errstr\n";;  
  151.  
  152. $sql = $dbh->prepare(qq{SELECT * FROM user_reg});  
  153.  $sql->execute(); 
  154.  
  155.  
  156. while (my @data = $sql->fetchrow_array()){  
  157.  
  158.       # Print the date from the first four columns in the table  
  159.       print $data[0], "\t", $data[1], "\t", $data[2], "\t", $data[3], "\t", $data[4], "\t", $data[5], "<br>";  
  160.  
  161. }
  162. 1;
  163.  
  164. #Let's see if the email_address conforms to the RFC822 specification
  165. print (Email::Valid->address('$email_address') ? 'yes' : 'no') "<br>";
  166.  
  167.  
Oct 22 '08 #8

KevinADC
Expert 2.5K+
P: 4,059
It appears the module is not succesfully installed. And if it was this line will not work:

Expand|Select|Wrap|Line Numbers
  1. Email::Valid->address('$email_address')
Don't put scalars inside of single-quotes, there is no variable interpolation inside of single-quotes. You should almost never quote a scalar unless you are making a new string, better to write it like this:

Expand|Select|Wrap|Line Numbers
  1. Email::Valid->address($email_address)
But you first need to make sure the module is in fact installed.
Oct 22 '08 #9

numberwhun
Expert Mod 2.5K+
P: 3,503
You need to learn to understand the errors that Perl is providing to you. This error is typical of a Perl module not being found in the path that is present in the @INC array.

Regards,

Jeff
Oct 22 '08 #10

100+
P: 236
Hi Gurus,

Thanks! I tried again and again to reinstall, the module just cant be installed. Any idea how to make sure we got the right ingredients and procedure?


Thanks in advance,
Andrew
Oct 22 '08 #11

KevinADC
Expert 2.5K+
P: 4,059
Hi Gurus,

Thanks! I tried again and again to reinstall, the module just cant be installed. Any idea how to make sure we got the right ingredients and procedure?


Thanks in advance,
Andrew
I have the module installed on my Windows box. I don't know why you are having problems getting it installed.
Oct 22 '08 #12

100+
P: 236
Hi Kevin,

It always give me


html error
=======
Software error:
Can't locate Email/Valid.pm in @INC (@INC contains: C:/perl/site/lib C:/perl/lib .) at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/acctman2.pl line 88.
BEGIN failed--compilation aborted at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/acctman2.pl line 88.

For help, please send mail to the webmaster (admin@gateway.2wire.net), giving this error message and the time and date of the error.


and also the perl package manager will give installation message saying that the packages is not installed. And the main modules are not synchronized for the installation, do I need to reinstall the whole windows package manager or is there any option to make sure all perl package manager's packages are installed...


Thanks,
Andrew
Oct 23 '08 #13

numberwhun
Expert Mod 2.5K+
P: 3,503
Hi Kevin,

It always give me


html error
=======
Software error:
Can't locate Email/Valid.pm in @INC (@INC contains: C:/perl/site/lib C:/perl/lib .) at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/acctman2.pl line 88.
BEGIN failed--compilation aborted at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/acctman2.pl line 88.

For help, please send mail to the webmaster (admin@gateway.2wire.net), giving this error message and the time and date of the error.


and also the perl package manager will give installation message saying that the packages is not installed. And the main modules are not synchronized for the installation, do I need to reinstall the whole windows package manager or is there any option to make sure all perl package manager's packages are installed...


Thanks,
Andrew
Andrew, if you read Kevins post, he already mentioned to you that that error means that the module, Email::Valid, is not installed. Before you can use a module you need to first install it.
Regards,

Jeff
Oct 23 '08 #14

100+
P: 236
Hi Kevin,

I tried on my another laptop to let perl package manager install the email::valid package and it installed successfully and gives good message

Synchronizing Database ...
Downloading ActiveState Package Repository packlist ... done
Updating ActiveState Package Repository database ... done
Synchronizing Database done

At the laptop which I previously installed some modules are successful the email::valid package cant be installed and gives error message

Synchronizing Database ...
Downloading ActiveState Package Repository packlist ... not synchronized
Updating ActiveState Package Repository database ... not synchronized
Synchronizing Database done

Not sure if I need to reinstall everything?? Cheers...

Thanks and Best Rgds,
Andrew
Oct 23 '08 #15

KevinADC
Expert 2.5K+
P: 4,059
Hi Kevin,

Not sure if I need to reinstall everything?? Cheers...

Thanks and Best Rgds,
Andrew
Hi Andrew,

To put it simply: I don't know. I've had Activeperl installed on my computer for years now. Read the PPM help files carefully and see if there are any sychronization options or other helpful suggestions. I've never had such a problem myself and you can read the help files as easily as I can.
Oct 23 '08 #16

100+
P: 236
Hi Kevin Guru,

Thanks again. I think in PPM, i missed out the step "run marked action", activated this before I install the application and it works fine. The
#Let's see if the email_address conforms to the RFC822 specification
print (Email::Valid->address($email_address) ? 'yes' : 'no'); is correct, the final result printed yes or no.

I shall try other modules as you recommended cheers...


Thanks...
Andrew

Expand|Select|Wrap|Line Numbers
  1.  
  2. #!c:\perl\bin\perl.exe 
  3. #!/usr/bin/perl 
  4. ############################################ 
  5. ##                                        ## 
  6. ##     Account Manager LITE User Signup   ## 
  7. ##          by SiteInteractive.com        ## 
  8. ##    http://siteinteractive.com/contact  ## 
  9. ##                                        ## 
  10. ##             version:  1.09             ## 
  11. ##       last modified:  07/24/2002       ## 
  12. ##        copyright (c) 1998 - 2002       ## 
  13. ##                                        ## 
  14. ##    latest version is available from    ## 
  15. ##        http://SiteInteractive.com      ## 
  16. ##                                        ## 
  17. ############################################ 
  18. # Copyright 1998 Elite Host.  All Rights Reserved. 
  19. # TERMS OF USE  
  20. # 1. Account Manager is for licensed customers 
  21. # only. Customer may use Account Manager as many 
  22. # times as customer wishes, as long as customer owns or runs the web 
  23. # site that Account Manager is installed on.  Account 
  24. # Manager may not under any circumstances be sold 
  25. # or redistributed without the written consent of CGI Script Center and 
  26. # its owner Diran Alemshah. 
  27. # 2. CGI Script Center, at its own discresion, will decide if any terms  
  28. # of the this agreement have been violated by customer. Upon written e- 
  29. # mailed notification to Customer of Terms of Use violations, CGI 
  30. # Script Center may revoke customer's license to use Account Manager. 
  31. # In that event, Customer agrees to any and all of the following: 
  32. # a) Customers found in violation of this agreement, found reselling or 
  33. # redistributing Account Manager, or making  
  34. # Customers Members Area ID and password public to anyone in any  
  35. # manner will forfeit their Members area password and all rights to  
  36. # future versions of Account Manager. 
  37. #  
  38. # b). Customer will no longer be licensed to run any version of  
  39. # Account Manager.  
  40. # Indemnification 
  41. # 1. Customer agrees that it shall defend, indemnify, save and hold 
  42. # CGI Script Center, Elite Web Design and marketing, and any 
  43. # persons affiliated with either company, harmless from any and all 
  44. # demands, liabilities, losses, costs and claims, including reasonable 
  45. # attorney's fees asserted against CGI Script Center, its agents, its 
  46. # customers, officers and employees, that may arise or result from any 
  47. # service provided or performed or agreed to be performed or any product 
  48. # sold by customer, its agents, employees or assigns. Customer agrees to 
  49. # defend, indemnify and hold harmless CGI Script Center, its agents, 
  50. # its cusomters, officers, and employes,against 
  51. # liabilities arising out of; a) any injury to person or property caused 
  52. # by an products sold or  otherwise distributed in connection with CGI 
  53. # Script Center products; (b) any material supplied by customer 
  54. # infringing or allegedly infringing on the proprietary rights of a 
  55. # third party; c) copyright infringement and (d) any defective products 
  56. # sold to customer from CGI Script Center products. 
  57. # This program may not be distributed in whole or part, freely, for pay,  
  58. # or any other form of compensation. 
  59. ##################################################  ############### 
  60. # This version designed for Win32 systems (NT).  If you require 
  61. # a Unix version, please contact cgi@elitehost.com 
  62. ##################################################  ############### 
  63.  
  64.  
  65. ##################################################  ############ 
  66. # EDIT USER CONFIGURATIONS BELOW 
  67. ##################################################  ############ 
  68.  
  69. # apache is in d DRIVE!!! not C
  70.  
  71. #require "d:/program files/apache software foundation/apache2.2/cgi-bin/config.pl"; 
  72.  
  73. # This completes this portion of your Account Manager setup 
  74. ##################################################  ############ 
  75. # DO NOT EDIT BELOW THIS LINE 
  76. ##################################################  ############ 
  77.  
  78. use CGI; 
  79. use CGI::Carp qw(fatalsToBrowser); 
  80. use DBD::mysql;
  81. use DBI;
  82. use Email::Valid;
  83.  
  84.  
  85. my $query = CGI->new; 
  86.  
  87. unless ($CGI::VERSION >= 2.47) {  
  88.    error('Your version of CGI.pm is too old. You must have verison 2.47 or higher to use this script.') 
  89.  
  90.  
  91. #SECTION B
  92. #=========================================
  93. #Database initialization and initial query
  94. my ($dbh, $data_source);  
  95. my $mysql_server_name   = 'localhost';  
  96. my $mysql_database_name = 'test';  
  97. my $mysql_user_name     = 'root';  
  98. my $mysql_password      = 'mysql1';  
  99.  
  100. my $data_source = 'DBI:mysql:' . $mysql_database_name . ':' . $mysql_server_name;  
  101. my $dbh = DBI->connect( $data_source, $mysql_user_name, $mysql_password, {RaiseError=>1}) ||  die "$DBI::errstr";   
  102.  
  103.  
  104.  
  105.  
  106. #important line to pass email address from html to perl
  107. my $agree_field = $query->param("agree") || 'Annonymous'; 
  108. my $first_name = $query->param("fname") || 'Annonymous'; 
  109. my $last_name = $query->param("lname") || 'Annonymous'; 
  110. my $email_address = $query->param("email") || 'Annonymous'; 
  111. my $user_name = $query->param("username") || 'Annonymous'; 
  112. my $password = $query->param("pwd") || 'Annonymous'; 
  113.  
  114.  
  115. # End of Database initial Query
  116. #==========================================
  117.  
  118. print $query->header(), 
  119.       $query->start_html(-title=>'Input Successful'), 
  120.       $query->p('Thanks for registrating your particulars with us!'), 
  121.       $query->p("You Agree? : $agree_field:"),
  122.       $query->p("Your First Name : $first_name"),
  123.       $query->p("Your last Name : $last_name"), 
  124.       $query->p("Your email address: $email_address"), 
  125.       $query->p("Your username : $user_name"), 
  126.       $query->p("Your Password : $password"), 
  127.       $query->end_html; 
  128.  
  129. sub error { 
  130.    print $query->header(), 
  131.          $query->start_html(-title=>'Error'), 
  132.          shift, 
  133.          $query->end_html; 
  134.    exit(0); 
  135.  
  136.  
  137. my $sql = $dbh->prepare(qq{SELECT * FROM user_reg}); 
  138.    $sql->execute(); 
  139.  
  140. while (my @data = $sql->fetchrow_array()) { 
  141.  
  142.       # Print the date from the first two columns in the table 
  143.       #print $data[0], "\t", $data[1], "<br>"; 
  144.        print $data[0], "\t", $data[1], "\t", $data[2], "\t", $data[3], "\t", $data[4], "\t", $data[5], "<br>";  
  145.  
  146. 1;
  147.  
  148.  
  149.  $sql = $dbh->prepare(qq{insert into user_reg(agree_field, first_name, last_name, email_address, user_name, password) values ( "$agree_field", "$first_name", "$last_name", "$email_address", "$user_name", "$password") } );  
  150.    $sql->execute() or die "$dbh->errstr\n";;  
  151.  
  152. $sql = $dbh->prepare(qq{SELECT * FROM user_reg});  
  153.  $sql->execute(); 
  154.  
  155.  
  156. while (my @data = $sql->fetchrow_array()){  
  157.  
  158.       # Print the date from the first four columns in the table  
  159.       print $data[0], "\t", $data[1], "\t", $data[2], "\t", $data[3], "\t", $data[4], "\t", $data[5], "<br>";  
  160.  
  161. }
  162. 1;
  163.  
  164. #Let's see if the email_address conforms to the RFC822 specification
  165. print (Email::Valid->address($email_address) ? 'yes' : 'no');
  166.  
  167.  
Oct 23 '08 #17

KevinADC
Expert 2.5K+
P: 4,059
Very good. Pretty soon you will be answering questions instead of asking them at the rate you're going. :)
Oct 23 '08 #18

100+
P: 236
Hi Kevin,

Please dont dig at me. hee hee. I am abit really effective sometimes when I see these codes....

Just want to complete the project. Cheers...


Thanks and Best Rgds,
Andrew
Oct 25 '08 #19

100+
P: 236
not really effective i meant... Typo... Hee hee
Oct 25 '08 #20

KevinADC
Expert 2.5K+
P: 4,059
Hi Kevin,

Please dont dig at me. hee hee. I am abit really effective sometimes when I see these codes....

Just want to complete the project. Cheers...


Thanks and Best Rgds,
Andrew
It wasn't a dig, it was a compliment. I meant that you seem to be learning quickly and in the near future you could be one of the people that is answering questions on forums, if that kind of thing interested you.

Kind regards,
Kevin
Oct 25 '08 #21

100+
P: 236
Hi Kevin,

Thanks. Not likely but will seriously consider...

Btw, I was trying about formsimple.pl, I compiled it but got the error below. I could not find the formvalidator::simple module at all, but found the formvalidator module.

Kindly advise why the package cant be found and the compilation error below.
Thanks in advance


Cheers...
Andrew


C:\Perl\bin>perl -c d:/formsimple.pl
Can't locate FormValidator/Simple.pm in @INC (@INC contains: C:/Perl/site/lib C:
/Perl/lib .) at d:/formsimple.pl line 2.
BEGIN failed--compilation aborted at d:/formsimple.pl line 2.


Expand|Select|Wrap|Line Numbers
  1.  
  2. #!C:\perl\bin\perl.exe
  3. use FormValidator::Simple;  
  4.  
  5.    my $q = CGI->new;
  6.     $q->param( year  => 2005 );
  7.     $q->param( month =>   12 );
  8.     $q->param(   day =>   27 );
  9.  
  10.     my $result = FormValidator::Simple->check( $q => [ 
  11.         { date => ['year', 'month', 'day'] } => [ 'DATE' ],
  12.     ] );
  13.  
  14.     [% IF result.invalid('date') %]
  15.     <p>Set correct date.</p>
  16.     [% END %]
  17.  
  18.  
Oct 25 '08 #22

numberwhun
Expert Mod 2.5K+
P: 3,503
That may end up being a case where PPM does not have the module available.

[soapbox]
That is one reason I hate active perl when working on Windows and now ONLY use Strawberry Perl. PPM is limited to what modules that ActiveState decides to port, thus they don't have all of them. So, if you want to be able to use any module, I would switch to Strawberry Perl
Installing modules with SP is as siimple as using the standard CPAN interface, thus, no limitations on modules available. :)
[/soapbox]

Regards,

Jeff
Oct 25 '08 #23

KevinADC
Expert 2.5K+
P: 4,059
PPM is limited to what modules that ActiveState decides to port
Not trying to split hairs Jeff but that is only true for modules Activestate decides to release as part of activeperl or via the activestate PPM repositories. Anyone is free to port modules over to PPM as you can see by checking modules available on other PPM repositories. DBD::mysql is an example. On activestate they have an old version 2.x (which only comes with perl 5.6) but the latest version is 4.x (on CPAN and one of the third party PPM repositories).

Of course the number of modules is still limited compared to CPAN and Strawberry perl is a good alternative for users that don't need commercial support or well tested industry standard performance. The makers of Strawberry perl are working on that though if you can judge by the website.
Oct 25 '08 #24

100+
P: 236
hi Jeff and Kevin,

Thanks, but can I install both strawberry and activestate perl at the same time? Any problem to use both manager's packages simultaneously?


Cheers...
Andrew
Oct 26 '08 #25

numberwhun
Expert Mod 2.5K+
P: 3,503
hi Jeff and Kevin,

Thanks, but can I install both strawberry and activestate perl at the same time? Any problem to use both manager's packages simultaneously?


Cheers...
Andrew
It would be an issue because on Windows, the shebang line is not read unless its a CGI script and you are using the -T option. So, you can't implicitly say "use this one" like you can in Unix. It will take whichever one is in the path variable first unless you kick the script off with the absolute path to the Perl interpreter you want to use.
Oct 26 '08 #26

numberwhun
Expert Mod 2.5K+
P: 3,503
Not trying to split hairs Jeff but that is only true for modules Activestate decides to release as part of activeperl or via the activestate PPM repositories. Anyone is free to port modules over to PPM as you can see by checking modules available on other PPM repositories. DBD::mysql is an example. On activestate they have an old version 2.x (which only comes with perl 5.6) but the latest version is 4.x (on CPAN and one of the third party PPM repositories).

Of course the number of modules is still limited compared to CPAN and Strawberry perl is a good alternative for users that don't need commercial support or well tested industry standard performance. The makers of Strawberry perl are working on that though if you can judge by the website.
**checks** Nope, no hairs damaged. :-) Although, I would rather only point to one place that has everything rather than have to point and a bunch of different repositories and still be limited.

I had more than one issue when I used ActiveState (before you told me about Strawberry Perl), where I couldn't find a module and voila, it had errors in its port or just wasnt ported altogether.
Oct 26 '08 #27

KevinADC
Expert 2.5K+
P: 4,059
I agree with Jeff. I wouldn't try installing Strawberry perl and Activeperl on the same machine unless you really know what you are doing. I'm not going to say its not possible, I did it once myself but it did create problems in the registry. Unfortunately I no longer remember what the problem was. I uninstalled Strawberry perl and activeperl and reinstalled activeperl to clear up whatever the problem was.

But that was also the first version of Strawberry perl. Newer versions seem to be working out bugs and you can now install it on a different drive besides the C drive like the version I had tried. So if you want to try it you do so at your own risk.
Oct 26 '08 #28

KevinADC
Expert 2.5K+
P: 4,059
**checks** Nope, no hairs damaged. :-) Although, I would rather only point to one place that has everything rather than have to point and a bunch of different repositories and still be limited.

I had more than one issue when I used ActiveState (before you told me about Strawberry Perl), where I couldn't find a module and voila, it had errors in its port or just wasnt ported altogether.
All true, but there are just as many and probably many more problematic modules posted on CPAN just because of the sheer number of modules. Anyone can post a module on CPAN that signs up with PAUSE , like yours truely, although after signing up and requesting a name space I never completed my intended module (File::Compare::Util). Maybe someday I will.

There is lots and lots of crappy and buggy modules posted on CPAN. I always urge people to read the bug reports and reviews of modules and check the authors other modules before using a module. Many modules are uploaded and quickly abandoned never to be updated even when bugs are reported.
Oct 26 '08 #29

numberwhun
Expert Mod 2.5K+
P: 3,503
All true, but there are just as many and probably many more problematic modules posted on CPAN just because of the sheer number of modules. Anyone can post a module on CPAN that signs up with PAUSE , like yours truely, although after signing up and requesting a name space I never completed my intended module (File::Compare::Util). Maybe someday I will.

There is lots and lots of crappy and buggy modules posted on CPAN. I always urge people to read the bug reports and reviews of modules and check the authors other modules before using a module. Many modules are uploaded and quickly abandoned never to be updated even when bugs are reported.
I completely agree that there are a lot of modules out there that are, as you say, crap. As a general rule of thumb, you don't want to look at anything below version 1.0, although there are a few modules that are the exception to that rule and are avidly used by myself and many others in the coummunity due to their stability and usefulness. Just as an example.... case in point. That module is heavily used in the software that I support at work. While I am not 100% about all its capabilities, what it can do is simply amazing and I recommend it to anyone working with complex configuration files.

I just realized that we have (somewhat) hijacked this thread without meaning to. My appologies to the OP that started it.

Regards,

Jeff
Oct 26 '08 #30

100+
P: 236
HI Kevin and all,

Thanks man! So recommended to uninstall activestate perl and install strawberry? Quite confused.


Thanks,
Andrew
Oct 26 '08 #31

numberwhun
Expert Mod 2.5K+
P: 3,503
HI Kevin and all,

Thanks man! So recommended to uninstall activestate perl and install strawberry? Quite confused.


Thanks,
Andrew
If you want to use Strawberry Perl over Active State, then yes, we recommend uninstalling one for the other. After you get Strawberry Perl installed, you can use these instructions for installing modules.

Regards,

Jeff
Oct 26 '08 #32

100+
P: 236
Hi Sir,

Thanks! If I install strawwberry perl will the below module be available?

use FormValidator::Simple;


Cheers...
Andrew
Oct 26 '08 #33

eWish
Expert 100+
P: 971
No, you will have to install it. It is not one of the core modules.

--Kevin
Oct 26 '08 #34

numberwhun
Expert Mod 2.5K+
P: 3,503
Hi Sir,

Thanks! If I install strawwberry perl will the below module be available?

use FormValidator::Simple;


Cheers...
Andrew
As Kevin said, only the core modules will initially be available. But, following the instructions in the link I sent, you can install other modules, including that one.

Regards,

jeff
Oct 26 '08 #35

100+
P: 236
Hi Jeff / Kevin,

Thanks! I managed to uninstall activestate perl and install strawberry perl,

Install the formvalidator::simple module (long process though as they have many dependencies to install)

used perl -c to check the sample script. but show the below error for print. Not sure what is the error as I changed many formats to print...


Thanks in advance
Andrew

Expand|Select|Wrap|Line Numbers
  1.  
  2. #!C:\perl\bin\perl.exe
  3. use FormValidator::Simple;  
  4.  
  5.    my $q = CGI->new;
  6.     $q->param( year  => 2005 );
  7.     $q->param( month =>   12 );
  8.     $q->param(   day =>   27 );
  9.  
  10.     my $result = FormValidator::Simple->check( $q => [ 
  11.         { date => ['year', 'month', 'day'] } => [ 'DATE' ],
  12.     ] );
  13.  
  14.     IF result.invalid('date')
  15.  
  16.     print "Set correct date";
  17.  
  18.  
Oct 27 '08 #36

KevinADC
Expert 2.5K+
P: 4,059
If you installed srawberryperl you have to change the shebang line to that of strawberry perl, it might be something like:
Expand|Select|Wrap|Line Numbers
  1. #!C:\strawberry-perl\bin\perl.exe
if perl is in the command path then all you need is:

Expand|Select|Wrap|Line Numbers
  1. #!perl
try the second one first

Also note that there is no IF keyword in perl. All of perls builtin operators and keywords are all lowercase letters. So "IF" should be "if".

You also have syntax errors which will not allow the script to compile, an "if" block is written one of two ways:

Expand|Select|Wrap|Line Numbers
  1. if (condition) {
  2.    expressions
  3. }
  4.  
or

Expand|Select|Wrap|Line Numbers
  1. expressions if (condition);
Oct 27 '08 #37

100+
P: 236
Hi Thanks Kevin,

I used small case and it worked.

For those previous scripts proved working with activestate, now is not working using strawberry. The ppm modules may not be ported over.

Anything to take note?


Cheers...
Andrew
Oct 27 '08 #38

numberwhun
Expert Mod 2.5K+
P: 3,503
If you installed srawberryperl you have to change the shebang line to that of strawberry perl, it might be something like:
Expand|Select|Wrap|Line Numbers
  1. #!C:\strawberry-perl\bin\perl.exe
if perl is in the command path then all you need is:

Expand|Select|Wrap|Line Numbers
  1. #!perl
Does it really matter? I don't think that the shebang line is read in the Windows world unless there is the -T for cgi scripts. Other than that, I think it is ignored and Perl should be kicked of with "perl <script>.pl" unless you have .pl files to automatically trigger perl. Either way, I don't think the shebang line matters most of the time in Windows.

Regards,

Jeff
Oct 27 '08 #39

KevinADC
Expert 2.5K+
P: 4,059
Does it really matter? I don't think that the shebang line is read in the Windows world unless there is the -T for cgi scripts. Other than that, I think it is ignored and Perl should be kicked of with "perl <script>.pl" unless you have .pl files to automatically trigger perl. Either way, I don't think the shebang line matters most of the time in Windows.

Regards,

Jeff

I'm confused by your -T reference. That has no affect on if the shebang line is read or not read. Windows ignores the shebang line all the time regardless of any switches used, but Apache does not ignore the shebang (it can be made to ignore it but thats another topic).

If he is running his CGI scripts from the command line then the shebang line is being ignored (regardless of the -T switch). If he runs them from Apache then the chances are 99.999% that the shebang line is being used.
Oct 27 '08 #40

numberwhun
Expert Mod 2.5K+
P: 3,503
I'm confused by your -T reference. That has no affect on if the shebang line is read or not read. Windows ignores the shebang line all the time regardless of any switches used, but Apache does not ignore the shebang (it can be made to ignore it but thats another topic).

If he is running his CGI scripts from the command line then the shebang line is being ignored (regardless of the -T switch). If he runs them from Apache then the chances are 99.999% that the shebang line is being used.
Ah, see.... that was my confusion. I must have read a bad explanation at one point. Thanks for clearing that up.

Jeff
Oct 27 '08 #41

100+
P: 236
Hi All,

Thanks! I tried to modify the script, end up having a error after many trials, the code is below. Not sure where is the problem?

Error
====
C:\strawberry\perl\bin>perl.exe d:formsimple.pl
Undefined subroutine &main::invalid called at d:formsimple.pl line 16.



Best Rgds,
Andrew


Expand|Select|Wrap|Line Numbers
  1. #!C:\strawberry-perl\bin\perl.exe
  2. use FormValidator::Simple;  
  3. use CGI;
  4. use cgi::Carp qw(fatalstoBrowser); 
  5. #print "Content-type: text/html\n\n"; 
  6.  
  7.    my $q = CGI->new;
  8.     $q->param( year  => 2005 );
  9.     $q->param( month =>   12 );
  10.     $q->param(   day =>   27 );
  11.  
  12.     my $result = FormValidator::Simple->check( $q => [ 
  13.         { date => ['year', 'month', 'day'] } => [ 'DATE' ],
  14.     ] );
  15.  
  16.     if (result.invalid('date'))
  17.     {
  18.     print "Please set correct date";
  19.     }
  20.  
  21.  
Oct 27 '08 #42

eWish
Expert 100+
P: 971
Andrew,

This line is not correct and the cause of your error.
Expand|Select|Wrap|Line Numbers
  1. if (result.invalid('date'))
I would suggest that you revisit the documentation for examples.

The line above is suppose included in your template and looking more like this.
Expand|Select|Wrap|Line Numbers
  1.     [% IF result.invalid('date') %]
  2.     <p>There is a problem with your date.</p>
  3.     [% END %]
Nor is this correct.
Expand|Select|Wrap|Line Numbers
  1. use cgi::Carp qw(fatalstoBrowser); 
Should be
Expand|Select|Wrap|Line Numbers
  1. use CGI::Carp qw(fatalsToBrowser);
--Kevin
Oct 27 '08 #43

KevinADC
Expert 2.5K+
P: 4,059
eWish has pointed out a number of problems. Keep in mind this is programming, this is not something simple like HTML code. The syntax and case (UPPER and lower cas) of programming code is extremely important.

Reading a modules documentation can be difficult, especially for beginners. I can how you messed up your code after reading the FormValidator::Simple documentation. The documentation is not perl beginner friendly.

I have never used the module so I can't help with how to use it.
Oct 27 '08 #44

100+
P: 236
Hi All,

This is the correct code.


Thanks,
Andrew


Expand|Select|Wrap|Line Numbers
  1. #!C:\strawberry\perl\bin\perl.exe
  2. use FormValidator::Simple;  
  3. use CGI;
  4.  
  5.    my $q = CGI->new;
  6.     $q->param( year  => 2005 );
  7.     $q->param( month =>   12 );
  8.     $q->param(   day =>   27 );
  9.  
  10.     my $result = FormValidator::Simple->check( $q => [ 
  11.         { date => ['year', 'month', 'day'] } => [ 'DATE' ],
  12.     ] );
  13.  
  14.     if (result.invalid('date'))
  15.     {
  16.     print "Please set correct date";
  17.     }
Oct 28 '08 #45

100+
P: 236
Hi All,

I tried to use this module in ppm, using use DBD::mysql; in my script, but the following ppm cant work as html error shown below. any idea what is happening? I tried to install this package in strawberry CPAN client below and keep having error.


Cheers...
Andrew

Expand|Select|Wrap|Line Numbers
  1. compilation in cpan
  2. ===============
  3. C:\strawberry\perl\bin>perl -c d:\u3.pl
  4. Status: 500
  5. Content-type: text/html
  6.  
  7. <h1>Software error:</h1>
  8. <pre>Can't locate DBD/mysql.pm in @INC (@INC contains: C:/strawberry/perl/lib C:
  9. /strawberry/perl/site/lib .) at d:\u3.pl line 9.
  10. BEGIN failed--compilation aborted at d:\u3.pl line 9.
  11. </pre>
  12. <p>
  13. For help, please send mail to this site's webmaster, giving this error message
  14. and the time and date of the error.
  15.  
  16. </p>
  17. [Tue Oct 28 08:19:26 2008] u3.pl: Can't locate DBD/mysql.pm in @INC (@INC contai
  18. ns: C:/strawberry/perl/lib C:/strawberry/perl/site/lib .) at d:\u3.pl line 9.
  19. [Tue Oct 28 08:19:26 2008] u3.pl: BEGIN failed--compilation aborted at d:\u3.pl
  20. line 9.
  21.  
  22.  
  23. Error shown in html
  24. ===============
  25. Can't locate DBD/mysql.pm in @INC (@INC contains: C:/strawberry/perl/lib C:/strawberry/perl/site/lib .) at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/u3.pl line 9.
  26. BEGIN failed--compilation aborted at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/u3.pl line 9.
Oct 28 '08 #46

numberwhun
Expert Mod 2.5K+
P: 3,503
Hi All,

I tried to use this module in ppm, using use DBD::mysql; in my script, but the following ppm cant work as html error shown below. any idea what is happening? I tried to install this package in strawberry CPAN client below and keep having error.


Cheers...
Andrew

Expand|Select|Wrap|Line Numbers
  1. compilation in cpan
  2. ===============
  3. C:\strawberry\perl\bin>perl -c d:\u3.pl
  4. Status: 500
  5. Content-type: text/html
  6.  
  7. <h1>Software error:</h1>
  8. <pre>Can't locate DBD/mysql.pm in @INC (@INC contains: C:/strawberry/perl/lib C:
  9. /strawberry/perl/site/lib .) at d:\u3.pl line 9.
  10. BEGIN failed--compilation aborted at d:\u3.pl line 9.
  11. </pre>
  12. <p>
  13. For help, please send mail to this site's webmaster, giving this error message
  14. and the time and date of the error.
  15.  
  16. </p>
  17. [Tue Oct 28 08:19:26 2008] u3.pl: Can't locate DBD/mysql.pm in @INC (@INC contai
  18. ns: C:/strawberry/perl/lib C:/strawberry/perl/site/lib .) at d:\u3.pl line 9.
  19. [Tue Oct 28 08:19:26 2008] u3.pl: BEGIN failed--compilation aborted at d:\u3.pl
  20. line 9.
  21.  
  22.  
  23. Error shown in html
  24. ===============
  25. Can't locate DBD/mysql.pm in @INC (@INC contains: C:/strawberry/perl/lib C:/strawberry/perl/site/lib .) at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/u3.pl line 9.
  26. BEGIN failed--compilation aborted at D:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/u3.pl line 9.
Before you can use a module, you must install it. Install the DBD::mysql module and that error will disappear.

Regards,

Jeff
Oct 28 '08 #47

100+
P: 236
Hi Jeff,

I typed in install dbd::mysql command in cpan, but it kept having error to install. Any idea?


Cheers...
Andrew
Oct 28 '08 #48

100+
P: 236
Hi Jeff,

I typed in install dbd::mysql command in cpan, but it kept having error to install. Any idea?


Cheers...
Andrew
Oct 28 '08 #49

numberwhun
Expert Mod 2.5K+
P: 3,503
Hi Jeff,

I typed in install dbd::mysql command in cpan, but it kept having error to install. Any idea?


Cheers...
Andrew
Can you possibly elaborate and show us the error(s) that you are receiving? We will definitely need to see them before being able to help you.

Regards,

Jeff
Oct 28 '08 #50

82 Replies

Post your reply

Sign in to post your reply or Sign up for a free account.