LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2014, 03:08 AM   #1
zak100
Member
 
Registered: Jul 2009
Posts: 225

Rep: Reputation: 2
problem with perl CGI::Session module


Hi,
I have installed CGI::Session module but still i am getting error with this module. I have even checked by restarting the computer. Some body please guide me.

Code:
[root@localhost cgi]# yum install perl CGI::Session
Loaded plugins: langpacks, refresh-packagekit
Package 4:perl-5.18.4-290.fc20.x86_64 already installed and latest version
No package CGI::Session available.
Nothing to do
[root@localhost cgi]# cat adminform2.pl
#!/usr/bin/perl

#NOTE This code has got prolem with session management
use CGI qw(:standard);
use CGI::Session;
use DBI;
my $ID;
my $Name;
my $Phone;

use CGI;
use CGI::Session;

$cgi = new CGI;
my $session = new CGI::Session(undef, $cgi, {Directory=>'/tmp'});
        
#$cookie = $cgi->cookie(CGISESSID => $session->id );
#print $cgi->header(-cookie=>$cookie);


print "Content-type: text/html\n\n";
print <<HTML_PAGE;

<html>
<head>
<title>Admin Page: Display Records,Edit, Delete and Insert</title>
</head>
<body>

<FORM method="post" action="/cgi-bin/insertbyAdmin.pl">
<TABLE BORDER ="0">
<TR>    
<TD>Name</TD>
<TD><input type="text" name="Name" value=""></TD>
</TR>
<TR>
<TD>Phone </TD> 
<TD><input type="text" name="Phone" value=""></TD>
</TR>
<TR>
<TD><h1>Insert Next Record: Select Yes or No</h1></TD></TR>
<TR>    
<TD><li> <INPUT TYPE="radio" NAME="Yes" value="Yes" unchecked> Yes </TD>
</TR>
<TR>    
<TD><li> <INPUT TYPE="radio" NAME="No" value="No.Return to Login" unchecked> No </TD>
</TR>
<TR><TD COLSPAN="2" ALIGN="RIGHT">
<input type="submit" name="submit" value="insertNext">   
</TD></TR></TABLE></FORM>

#$ID = $cgi->param( 'ID' ) || '';
$Name = $cgi->param ('Name') || '';
$Phone = $cgi->param( 'Phone' ) || '';

$session->param(name1, $Name);
$session->param(Phone1, $Phone);
#$session->param(semester_, $semester);

<form method ="post" action="/cgi-bin/radioeditordelete.pl">
<TABLE BORDER ="0">
<TR><TD><input type="submit" name="EditDelete" value="EditDeleteRecord">    </TD></TR>
<TD><li> <INPUT TYPE="radio" NAME="EditDelete" value="Edit" unchecked> Edit </TD>
<TD> ID: </TD>
<TD> <input type="text" name="ID1" value=""></TD>
</TR>
<TR>
<TD><li> <INPUT TYPE="radio" NAME="EditDelete" value="Delete" unchecked> Delete</TD>
<TD> ID: </TD>
<TD> <input type="text" name="ID1" value=""></TD>
</TR>
</TABLE></FORM>
HTML_PAGE


$dbh = DBI->connect("dbi:mysql:test", 'root','') or die "Unable to connect: $DBI::errstr\n";
## query the database
	$sth = $dbh->prepare("SELECT * FROM samples");
$sth->execute();
print <<HTML_PAGE;
<table>
	<tr>
	<th>ID</th>
	<th>Name</th>
	<th>Phone</th>
	</tr>

HTML_PAGE
while($row = $sth->fetchrow_hashref) {
#$first_name = chop($row->{first_name});
#$surname= chop($row->{surname});
#$email = cho($row->{email});
#print "<tr><td>" . $first_name . "</td> </tr>&nbsp;";
#print "<tr><td>" . $surname . "</td> </tr>&nbsp;";
#print "<tr><td>" . $email . "</td></tr> &nbsp;";
print "<td>$row->{ID}</td> &nbsp;";
print "<td>$row->{Name}</td> &nbsp;";
print "<td>$row->{Phone}</td></tr> &nbsp;";
print "<br>";
}
print <<HTML;
</table>
</BODY></HTML>
HTML
[root@localhost cgi]# vi adminform2.pl
[root@localhost cgi]# perl adminform2.pl
Can't locate CGI/Session.pm in @INC (you may need to install the CGI::Session module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at adminform2.pl line 5.
BEGIN failed--compilation aborted at adminform2.pl line 5.
[root@localhost cgi]#
Some body please guide me.
Zulfi.
 
Old 10-27-2014, 09:41 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,667

Rep: Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710
Try
Code:
yum install perl-CGI-Session
 
Old 10-28-2014, 12:15 AM   #3
zak100
Member
 
Registered: Jul 2009
Posts: 225

Original Poster
Rep: Reputation: 2
Thanks for helping me. This problem is solved now.

Zulfi.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with session (CGI::Session) shifter Programming 1 03-20-2010 11:14 AM
Perl: Storing Cart-Like items in Mysql without CGI::Session zachet Programming 5 03-11-2010 12:29 PM
How to program the CGI module in Perl (newbie question) resetreset Programming 3 12-01-2008 03:08 AM
perl CGI::Session sci3ntist Programming 1 03-07-2008 09:39 AM
CGI Perl problem with :session -debug craig467 Programming 2 07-20-2006 09:45 AM


All times are GMT -5. The time now is 05:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration