LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem with perl CGI::Session module (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-perl-cgi-session-module-4175523442/)

zak100 10-27-2014 02:08 AM

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.

smallpond 10-27-2014 08:41 PM

Try
Code:

yum install perl-CGI-Session

zak100 10-27-2014 11:15 PM

Thanks for helping me. This problem is solved now.

Zulfi.

xo)mora 02-08-2018 11:15 AM

No package perl-CGI::Session available
 
I have the same error and I executed:
# yum install perl-CGI::Session
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 15 kB 00:00:00
extras | 3.4 kB 00:00:00
mariadb | 2.9 kB 00:00:00
updates | 3.4 kB 00:00:00
webtatic | 3.6 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirror.cenac.ipn.mx
* epel: fedora-epel.mirror.iweb.com
* extras: mirror.cenac.ipn.mx
* updates: mirror.cenac.ipn.mx
* webtatic: sp.repo.webtatic.com
No package perl-CGI::Session available.
Error: Nothing to do

What happen? Could you help me please.

jkirchner 02-09-2018 05:23 AM

Quote:

Originally Posted by xo)mora (Post 5817369)
I have the same error and I executed:
# yum install perl-CGI::Session
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 15 kB 00:00:00
extras | 3.4 kB 00:00:00
mariadb | 2.9 kB 00:00:00
updates | 3.4 kB 00:00:00
webtatic | 3.6 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirror.cenac.ipn.mx
* epel: fedora-epel.mirror.iweb.com
* extras: mirror.cenac.ipn.mx
* updates: mirror.cenac.ipn.mx
* webtatic: sp.repo.webtatic.com
No package perl-CGI::Session available.
Error: Nothing to do

What happen? Could you help me please.

Sure you did not type the command correctly. It is: yum install perl-CGI-Session

Instead of the dash between CGI and Session you typed this ::

Now, you necro'd a four year old thread. I am only pointing out the typo I saw. I did not check that the package is the same name or even still exists.

zak100 02-09-2018 10:45 AM

Thanks jkirchner for solving this prob on my behalf.

Zulfi.

xo)mora 02-09-2018 11:09 AM

Thank a lot jkirchne.


All times are GMT -5. The time now is 03:47 AM.