title: Perl dancer error execute method undefined
body: <p>I was trying to make a website using perl dancer, below is my code. It seems to be correct but the page keeps loading and never enters the values in the database. When I cancel the page I get an error stating "<code>request to POST /appform crashed: Can't call method "execute" on an undefined value</code>". I can't figured out whats wrong in the code. If you have any other code please mention. 
  I am using SQLite for database.
  There is a database <code>campus.db</code>and I am inserting the value in <code>student</code> table.</p>
  
  <pre><code>post '/appform' =&gt; sub {
  
          my $q = CGI -&gt;new;
          my $name = $q-&gt;param ("firstname");
          my $password = $q-&gt;param("password");
          my $mobile_no = $q-&gt;param("mobile");
          my $gender = $q-&gt;param("gender");
          my $email = $q-&gt;param("email");
          my $address = $q-&gt;param("address");
          my $sslc = $q-&gt;param("SSLC");
          my $hsc = $q-&gt;param("HSC");
          my $cgpa = $q-&gt;param("cgpa");
          my $languages = $q-&gt;param("lang");
          my $internships = $q-&gt;param("intern");
          my $preferred_loc = $q-&gt;param("country");
          my $sql = "insert into student(name,mobile_no,gender,email,address,sslc,hsc,cgpa,languages,internships,preferred_loc,password,applied_job,company_applied) values ('?','?','?','?','?','?','?','?','?','?','?','?','?','?');";
          my $sth = database-&gt;prepare($sql); 
          $sth-&gt;execute($name,$mobile_no,$gender,$email,$address,$sslc,$hsc,$cgpa,$languages,$internships,$preferred_loc,$password) or die $sth-&gt;errstr;
          #$sth-&gt;execute();   
          $sth-&gt; finish;
          set_flash('New entry posted!');
              redirect '/';
      };
  </code></pre>