#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    6
    Rep Power
    0
    Hello all,

    Thanks a lot for your kindness and time!

    I used to use DBI very fine in Linux system. Now I use UNIX and it drives me crazy by little bugs that I can never figure out. Please help me!

    I just say

    use DBI;
    use Strict;

    then I connect to the database, print something, disconnect, then exit by "exit;" Then after the "exit;" statement, I have all the function definitions. The last line of my file is an empty line.

    It worked, but one day I moved the "exit;" statement, and then put it back, it don't work anymore. It always give me this error and all the errors following this reason "syntax error in file job.pl at line 3, next 2 tokens "use DBI""

    I took out everything, and started over to make a very very simple file just to have the "use DBI;" and the connection. It still doesn't work.

    I guess that I missed an empty space somewhere. Is there anything you can suggest for me to check. I really really appreciate your kindness and time.

    Best regards,

    Dave.
    Desparately wait for your help.
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Check it out your dbi module wether it is properly available or not.

    Please post your code here .so we can tell you if it is missing something.



    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    6
    Rep Power
    0
    Thank you all. I really appreciate if you can find anything not right. I don't mean to ask you to do the job for me. But I am really stuck and I have no way to solve it unless I get you guys' help.

    Million thanks. This used to work just fine.

    Dave.

    #! /usr/bin/perl

    use DBI;
    use strict;

    my %INPUT;
    my %INPUT_TO_COL;
    my %INPUT_TO_QUOTE;
    my ($sth, $dbh);
    my ($namevalues,$namevalue,$name,$value,$valueToColons, $valueToQuotes);
    my @namevalues;

    &parseForm;
    &printHeader;

    $dbh = DBI->connect('DBI:mysql:employee') or die "Couldn't connect to database:".DBI->errstr;

    my %BodyStates=(
    'reviewJobForm'=>&createReviewPageBody,
    'submitJobForm'=>&createThankYouPageBody,
    );

    if ($BodyStates{$INPUT{sig}}) {
    $BodyStates{$INPUT{sig}}->();
    }
    else
    {
    print "We appologize. We can not find the page.";
    }

    &printFooter;
    $dbh->disconnect ();
    exit;

    #########################################
    #
    #
    #########################################
    sub parseForm
    {
    # Start parsing data
    read(STDIN, $namevalues, $ENV{'CONTENT_LENGTH'});
    @namevalues = split(/&/, $namevalues);
    foreach $namevalue (@namevalues) {
    ($name, $value) = split(/=/, $namevalue);
    $name =~ tr/+/ /;
    $value =~ tr/+/ /;
    $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/nn/<br><br>/g;
    $value =~ s/n/<br>/g;
    $value =~ s/<!--(.|n)*-->//g;

    #Convert double quote to :::
    #and single quote to ::
    if ($INPUT_TO_COL{$name}) {
    $valueToColons = $value;
    $valueToColons =~ s/"/:::/g;
    $valueToColons =~ s/'/::/g;
    $INPUT_TO_COL{$name} .= ",$valueToColons";
    }
    else
    {
    $valueToColons = $value;
    $valueToColons =~ s/"/:::/g;
    $valueToColons =~ s/'/::/g;
    $INPUT_TO_COL{$name} = $valueToColons;
    }

    #Convert ::: back to double quote
    # and :: to single quote
    if ($INPUT_TO_QUOTE{$name}) {
    $valueToQuotes = $value;
    $valueToQuotes =~ s/:::/"/g;
    $valueToQuotes =~ s/::/'/g;
    $INPUT_TO_QUOTE{$name} .= ",$valueToQuotes";
    }
    else
    {
    $valueToQuotes = $value;
    $valueToQuotes =~ s/:::/"/g;
    $valueToQuotes =~ s/::/'/g;
    $INPUT_TO_QUOTE{$name} = $valueToQuotes;
    }

    #Exact input
    if ($INPUT{$name}) {
    $INPUT{$name} .= ",$value";
    }
    else
    {
    $INPUT{$name} = $value;
    }

    }#end of foreach loop


    }#close parsing data
    #########################################
    #
    #
    #########################################
    sub createReviewPageBody
    {
    print "<center><TABLE width=550 valign=top cellpadding=0 cellspacing=0>

    <TR>
    <TD width=550 valign=top cellpadding=0 cellspacing=0><BR>
    <TABLE width=550 valign=top cellpadding=0 cellspacing=0>
    <TR>
    <TD width=250 valign=top cellpadding=0 cellspacing=0>
    <font color="#000088"><B>Contact Information </B></font><BR>
    </TD>
    <TD width=50 valign=top cellpadding=0 cellspacing=0>
    </TD>
    <TD width=250 valign=top cellpadding=0 cellspacing=0>
    <font color="#000088"><B>Interest</B></font><BR>
    </TD>
    </TR>
    </TABLE>
    </TD>
    </TR>
    <TR>
    <TD cellpadding=0 cellspacing=0>
    <HR>
    </TD>
    </TR>
    <TR>
    <TD width=550 valign=top cellpadding=0 cellspacing=0>
    <TABLE width=550 valign=top cellpadding=0 cellspacing=0>
    <TR>
    <TD width=250 valign=top>
    $INPUT{title} $INPUT{firstname} $INPUT{lastname}<BR>
    $INPUT{address}<BR>

    ($INPUT{phone1}) $INPUT{phone2}-$INPUT{phone3}<BR>
    $INPUT{email} <BR>
    Preferred contact by $INPUT{preferred}<BR>
    </TD>
    <TD width=50 valign=top > </TD>
    <TD width=250 valign=top>

    Interest: $INPUT{interest} <BR>

    </TD>
    </TR>
    </TABLE>
    <BR>


    </TD>
    </TR>
    <TR>
    <TD width=630 valign=top><font color="#000088"><B>Resume</B></font><HR><BR>
    <PRE>$INPUT{resume}</PRE>
    <BR><BR>
    </TD>
    </TR>
    <TR>
    <TD width=630 valign=top><font color="#000088"><B>Cover Letter</B></font><HR><BR>
    <PRE>$INPUT{letter}</PRE>

    </TD>
    </TR>
    <TR>
    <TD width=630 valign=top> <BR><BR><HR><BR>
    <!-- hidden form to for edit or submit -->
    <FORM NAME="form1" ACTION="/cgi-bin/jobs/job.pl" METHOD=POST>
    <INPUT TYPE=hidden name="title" value="$INPUT_TO_COL{title}"><BR>
    <INPUT TYPE=hidden name="firstname" value="$INPUT_TO_COL{firstname}">
    <INPUT TYPE=hidden name="lastname" value="$INPUT_TO_COL{lastname}">
    <INPUT TYPE=hidden name="address" value="$INPUT_TO_COL{address}">
    <INPUT TYPE=hidden name="phone1" value="$INPUT_TO_COL{phone1}">
    <INPUT TYPE=hidden name="phone2" value="$INPUT_TO_COL{phone2}">
    <INPUT TYPE=hidden name="phone3" value="$INPUT_TO_COL{phone3}">
    <INPUT TYPE=hidden name="email" value="$INPUT_TO_COL{email}">
    <INPUT TYPE=hidden name="preferred" value="$INPUT_TO_COL{preferred}">
    <INPUT TYPE=hidden name="interest" value="$INPUT_TO_COL{interest}">
    <INPUT TYPE=hidden name="resume" value="$INPUT_TO_COL{resume}">
    <INPUT TYPE=hidden name="letter" value="$INPUT_TO_COL{letter}">
    <INPUT TYPE=hidden name="sig" value="submitJobForm">
    <INPUT TYPE=button NAME="goback" VALUE="Back" onClick="goback()">
    <INPUT TYPE=submit VALUE="Submit" >
    <INPUT TYPE=button NAME="cancel" VALUE="Cancel" onClick="cancelbutton()">
    <BR><BR>
    </FORM>

    </TD>
    </TR>
    </TABLE></center>";
    }

    #########################################
    #
    #
    #########################################
    sub createThankYouPageBody
    {
    my $contactTitle = $dbh->quote("$INPUT_TO_QUOTE{title}");
    my $firstname = $dbh->quote("$INPUT_TO_QUOTE{firstname}");
    my $lastname = $dbh->quote("$INPUT_TO_QUOTE{lastname}");
    my $address = $dbh->quote("$INPUT_TO_QUOTE{address}");
    my $areaCode = $dbh->quote("$INPUT_TO_QUOTE{phone1}");
    my $cityCode = $dbh->quote("$INPUT_TO_QUOTE{phone2}");
    my $phone = $dbh->quote("$INPUT_TO_QUOTE{phone3}");
    my $email = $dbh->quote("$INPUT_TO_QUOTE{email}");
    my $preferred = $dbh->quote("$INPUT_TO_QUOTE{preferred}");
    my $resume = $dbh->quote("$INPUT_TO_QUOTE{resume}");
    my $letter = $dbh->quote("$INPUT_TO_QUOTE{letter}");

    $sth = $dbh->prepare(qq{INSERT INTO RESUME (RESUME_contactTitle, RESUME_firstname,RESUME_lastname,
    RESUME_address, RESUME_areaCode, RESUME_cityCode,
    RESUME_phone, RESUME_email, RESUME_preferred,
    RESUME_resume, RESUME_letter)
    VALUES ($contactTitle,$firstname,$lastname,$address,$areaCode,$cityCode,$phone,$email,
    $preferred,$resume, $letter)
    });


    $sth->execute()
    or die "Couldn't execute statement:".$sth->errstr;

    $sth->finish();


    print "<TABLE cellspacing=0 cellpadding=0 width="100%">
    <TR>
    <TD cellspacing=0 cellpadding=0 width="1" bgcolor="#FFCC00">
    <IMG SRC="http://mydomain.com/images/bluedot.gif" >
    </TD>

    <TD cellspacing=0 cellpadding=0 width="147" bgcolor="#FFFFCC" valign=top><BR><BR><BR>

    <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR> <BR><BR>

    </TD>
    <TD cellspacing=0 cellpadding=0 width="2" bgcolor="#FFCC00">
    <IMG SRC="http://mydomain.com/images/bluedot.gif">
    </TD>
    <TD cellspacing=0 cellpadding=0 width="30" > </TD>
    <TD cellspacing=0 cellpadding=0 width="515" valign=top>
    <TABLE cellspacing=0 cellpadding=0 width="515" valign=top >
    <TR>
    <TD cellspacing=0 cellpadding=0 width="515" valign=top>
    <BR><font color="#000077" size=4><B>Thank you!</B></font><BR><BR>
    <font color="">
    Thank you, $INPUT_TO_QUOTE{title} $INPUT_TO_QUOTE{firstname}
    $INPUT_TO_QUOTE{lastname}, for your interest in mydomain. We will contact you when we
    have the appropriate positions.
    Your resume record will remain active in our database for three months. Please feel free
    to resubmit your resume after that period.<BR><BR>

    Best regards,<BR><BR>


    mydomain, LLC.<BR><BR></font>
    </TD>
    </TR>
    </TABLE>
    </TD>
    <TD width=60> </TD>
    </TR>
    </TABLE>";
    }
    #########################################
    #
    #
    #########################################
    sub printJavaScript
    {

    print "
    <SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
    function goback ()
    {
    window.history.go(-1);
    }
    function cancelbutton ()
    {
    if (confirm ("Are you sure you want to cancel your resume submission?"))
    {
    location.replace("contact.html");
    }
    }
    </SCRIPT>";
    }
    #########################################
    #
    #
    #########################################

    sub printHeader
    {
    print "<HEAD>
    <TITLE>mydomain Contact Information</TITLE>
    <STYLE type="text/css">
    a:link{color:"blue";text-decoration:none}

    a:visited{color:"blue";text-decoration:none}

    a:hover{color:red;text-decoration:none}

    a:active{color:"#12E508";text-decoration:none}
    </STYLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">";

    &printJavaScript ;

    print "</HEAD>
    <BODY BGCOLOR="#FFFFFF" marginheight="2" marginwidth="2" topmargin="2" leftmargin="2" >
    <table border="0" width="775" cellpadding="0" cellspacing="0" valign=top>
    <tr>
    <td border="0" width="635" cellpadding="0" cellspacing="0" valign=top >

    <table border="0" width="635" cellpadding="0" cellspacing="0" valign=top >
    <tr>
    <td border="0" cellpadding="0" cellspacing="0" >
    <table border="0" cellpadding="0" cellspacing="0" valign=top>
    <tr>
    <td border="0" cellpadding="0" cellspacing="0" valign=top>
    <IMG SRC="http://mydomain.com/images/bluemydomainlabel.gif" border=0>
    <A NAME="0"> </A>
    </td>
    <td border="0" cellpadding="0" cellspacing="0" valign=bottom>
    <center><font size=3 color="#269ee8"><i>We collect prices, you collect money...</i></font></center><BR>

    </td>
    </tr>
    </table>
    </td>
    </tr>

    <tr>
    <td border="0" width="635" cellpadding="0" cellspacing="0" valign=top align=center >


    </td>
    </tr>
    </table>

    </td>
    <td bgcolor="white" cellpadding="0" cellspacing="0" valign=top border=0>

    </td>
    </tr>
    </table>

    <table width="775" cellpadding="0" cellspacing="0" valign=top border=0 bgcolor="black">
    <tr>

    <td width="775" cellpadding="0" cellspacing="0" valign=top border=0 bgcolor="black">
    <center>
    <A HREF="http://mydomain.com">
    <font color="#FFFFFF" size=1><B>HOME</B></font></A>
    <A HREF="/newusers.html">
    <font color="#FFFFFF" size=1><B>NEW USERS</B></font></A>
    <A HREF="/services.html">
    <font color="#FFFFFF" size=1><B>SERVICES</B></font></A>
    <A HREF="/talkboard.html">
    <font color="#FFFFFF" size=1><B>TALK BOARD</B></font></A>
    <A HREF="/findstore.html">
    <font color="#FFFFFF" size=1><B>FIND STORES</B></font></A>
    <A HREF="/livehelp.html">
    <font color="#FFFFFF" size=1><B>LIVE HELP</B></font></A>
    <A HREF="/contact.html">
    <font color="#FFFFFF" size=1><B>CONTACT US</B></font></A></B></font>
    </center>
    </td>

    </tr>
    </table>
    <TABLE WIDTH="775" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#FFCC00">
    <TR>

    <TD ALIGN="CENTER" WIDTH="775" BORDER="0" CELLSPACING="0" CELLPADDING="0" >
    <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER">


    <TR>
    <TD BGCOLOR="#666633" COLSPAN="3"><IMG SRC="http://mydomain.com/images/bluedot.gif" WIDTH="1" HEIGHT="1" BORDER="0"></TD>
    </TR>
    <TR>
    <TD BGCOLOR="#999966" COLSPAN="3"><IMG SRC="http://mydomain.com/images/bluedot.gif" WIDTH="1" HEIGHT="1" BORDER="0"></TD>
    </TR>

    <FORM ACTION="">
    <TR>
    <TD WIDTH="775" BORDER="0" CELLSPACING="0" CELLPADDING="0" ><center>
    <B>Search</B>

    <SELECT>
    <OPTION>Internet Services
    <OPTION>Hardware
    <OPTION>Software
    <OPTION>Electronics
    <OPTION>Office Supplies
    <OPTION>Telecom & Wireless
    <OPTION>Magazines
    <OPTION>Apparel & Accessories
    <OPTION>Sports & Leisure
    <OPTION>Gifts & Flowers
    <OPTION>Jewelry & Accessories
    <OPTION>Home & Garden


    </SELECT> <INPUT TYPE=text size=15 name=search> <IMG SRC="http://mydomain.com/images/gobutton.gif">
    </center>
    </TD>

    </TR>
    </FORM>

    </TABLE>
    </TD>

    </TR>
    <TR>
    <TD BGCOLOR="#999966" COLSPAN="3"><IMG SRC="http://mydomain.com/images/bluedot.gif" WIDTH="1" HEIGHT="1" BORDER="0"></TD>
    </TR>
    <TR>
    <TD BGCOLOR="#666633" COLSPAN="3"><IMG SRC="http://mydomain.com/images/dot.gif" WIDTH="1" HEIGHT="1" BORDER="0"></TD>
    </TR>
    </TABLE>";
    }
    #########################################
    #
    #
    #########################################
    sub printFooter
    {
    print "
    <table cellspacing=0 cellpadding=0 width="775">
    <tr>
    <td width="775" bgcolor="black" cellpadding="0" cellspacing="0" align=center height=25>
    <B>
    <font color="white" size=3>FAQs
    Advertising
    Join mydomain
    Discussion board
    News list </font></B>
    </td>
    </tr>
    <tr><td valign=bottom width=775 cellpadding="0" cellspacing="0">
    <center>
    <table valign=bottom width=600 cellpadding="0" cellspacing="0">
    <tr>
    <td valign=bottom width=600 cellpadding="0" cellspacing="0">
    <BR><CENTER>
    <A HREF=""><font size=3>100 Hots</font></A>
    <font color="green" >|</font>
    <A HREF=""><font size=3>Clearance</font></A>
    <font color="green" >|</font>
    <A HREF=""><font size=3>Free Values</font></A>
    <font color="green" >|</font>
    <A HREF=""><font size=3>Live Help</font></A>
    <BR>
    <A HREF=""><font size=3>Home</font></A> <font color="green">|</font>
    <A HREF=""><font size=3>Company Info</font></A> <font color="green">|</font>
    <A HREF=""><font size=3>Partners</font></A>
    <font color="green" >|</font>
    <A HREF=""><font size=3>Customer Service</font></A>
    <font color="green" >|</font>
    <A HREF=""><font size=3>Your Privacy</font></A>
    <font color="green" >|</font>
    <A HREF=""><font size=3>Copyright</font></A>

    <font color="green" >|</font>
    <A HREF=""><font size=3>Contact</font></A>
    <br><font size=3>
    2000 mydomain, LLC.</font></center>
    </td></tr>
    </table>
    </center>
    </td></tr>
    </table>

    </body>
    </html>";
    }

  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    6
    Rep Power
    0
    By the way, I don't use my own server. I just use a virtual server from rhyton.com and I think the dbi module should work fine.

    Dave.
  8. #5
  9. No Profile Picture
    RyanP
    Guest
    Devshed Newbie (0 - 499 posts)
    By the way, don't cross post and use the CODE tags.
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    19
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by DaveVN:

    [/quote]
    You can try to debug the script yourself.
    Insert 'print "some markn"' into the subroutines, run the script through TELNET session and check content of a string after the last "mark" that was printed.


IMN logo majestic logo threadwatch logo seochat tools logo