title: Why does my CGI script complain "Can't locate CGI/Session.pm in @INC"?
body: <p>I am having a html file which will accept and send the login and password. It is sent to the file login.cgi.</p>
  
  <p>**</p>
  
  <ul>
  <li><em>html file</em></li>
  </ul>
  
  <p>**</p>
  
  <pre><code>&lt;form method="POST" action="login.pl"&gt;
  &lt;table &gt;
  &lt;tr&gt;
      &lt;td&gt;Username &lt;/td&gt;
      &lt;td bgcolor="lightgrey"&gt;&lt;input type="text" name="usr" size="20"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;Password &lt;/td&gt; 
      &lt;td bgcolor="lightgrey"&gt;&lt;input type="password" name="pwd" size="20"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;&lt;input type="submit" id ="Login" value="Login" name="login"/&gt; &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>**</p>
  
  <ul>
  <li><em>.pl</em></li>
  </ul>
  
  <p>**</p>
  
  <pre><code>#!/usr/bin/perl
  
    # login.pl
    use CGI;
    use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
    use CGI::Session ( '-ip_match' );
  
    $q = new CGI;
  
    $usr = $q-&gt;param('usr');
    $pwd = $q-&gt;param('pwd');
  
    if($usr ne '')
    {
        # process the form
        if($usr eq "demo" and $pwd eq "demo")
        {
            $session = new CGI::Session();
            print $session-&gt;header(-location=&gt;'home.html');
        }
        else
        {
            print $q-&gt;header(-type=&gt;"text/html",-location=&gt;"LoginHtml.html");
        }
    }
    elsif($q-&gt;param('action') eq 'logout')
    {
        $session = CGI::Session-&gt;load() or die CGI::Session-&gt;errstr;
        $session-&gt;delete();
        print $session-&gt;header(-location=&gt;'LoginHtml.html');
    }
    else
    {
        print $q-&gt;header;
        print &lt;
            &lt;form method="post"&gt;
            Username: &lt;input type="text" name="usr"&gt;
  
            Password: &lt;input type="password" name="pwd"&gt;
  
  
            &lt;input type="submit"&gt;
            &lt;/form&gt;
    HTML
    }
  </code></pre>
  
  <p>After starting the apache server, i open the page and enter the username as demo and password as demo and click on the button.</p>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>Software error:</p>
    
    <p>Can't locate CGI/Session.pm in @INC
    (@INC contains:
    /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.8
    /usr/lib/perl5/site_perl/5.8.7
    /usr/lib/perl5/site_perl/5.8.6
    /usr/lib/perl5/site_perl/5.8.5
    /usr/lib/perl5/site_perl
    /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.8
    /usr/lib/perl5/vendor_perl/5.8.7
    /usr/lib/perl5/vendor_perl/5.8.6
    /usr/lib/perl5/vendor_perl/5.8.5
    /usr/lib/perl5/vendor_perl
    /usr/lib/perl5/5.8.8/i386-linux-thread-multi
    /usr/lib/perl5/5.8.8 .) at
    /var/www/cgi-bin/login.pl line 6.
    BEGIN failed--compilation aborted at
    /var/www/cgi-bin/login.pl line 6.</p>
    
    <p>For help, please send mail to the
    webmaster (root@localhost), giving
    this error message and the time and
    date of the error.</p>
  </blockquote>
  
  <p>Please help me out to resolve this error.</p>
  
  <p>**</p>
  
  <ul>
  <li><em>EDIT 1</em></li>
  </ul>
  
  <p>**</p>
  
  <p>Problem resolved after installing CGI-Session-4.42.</p>
  
  <p>Thanks to all of you, for your help.</p>