Hi,
When i do change event from my select drop down from my template.
In my cgi file i got this parameter from template as
$testversions=$query->param('Testcase_Version');
where i get the output
TC11.xml*1.2
I pass this output value to my pm file to an function
sub change_event
in my pm file.
use hiSession; sub change_event { my ($this,$Testcase_Version)=@_; my $mycart = hiSession->new(); my $session = $mycart->sess_load(); # chk for session expire if ($mycart->sess_check_expire($session)) { exit(0); } my $cart_test; my %test_info; if($mycart->sess_get_key_value($session, 'Testver')) { $cart_test=$mycart->sess_get_key_value($session, 'Testver'); %test_info = %$cart_testbed_info; } print "#########Retrive from cart"; print Dumper \%test_info; print "##########################"; my %tc_ver_prev_cart; chomp(my (@testcasenameofver) = split /\*/,$Testcase_Version); $tc_ver_prev_cart{testcasename}=$testcasenameofver[0]; $tc_ver_prev_cart{testcasever}=$testcasenameofver[1]; print Dumper \%tc_ver_prev_cart; $mycart->sess_set_key_value($session,"Testver",\%tc_ver_prev_cart) +; }

Next time,i select different option in drop down for that i have got the output
TC12.xml*1.5
But i need to store previous value ie TC11.xml*1.2 also for some processing .
So,i decided to put that parameter in session and retrive it using sess_get_key_value.I have used that session module of perl.
sess_set_key_value
sess_get_key_value
But i cant able to retain the previous value .I am not getting expected output.
I am getting as
#########Retrive from CART $VAR1 = {}; ############################################ $VAR1 = { 'testcasename' => 'TC12.xml', 'testcasever' => '1.5' };
First time %testbed_info will be undef,but next time it should contain previous parameter.
Every time i am not getting anything in the hash %testbed_info.Its empty always.
But i need to retrive previous value as well as current value
something as
$VAR1 = {'testcasename' => 'TC11.xml', 'testcasever' => '1.2', 'testcasename' => 'TC12.xml', 'testcasever' => '1.5' };
from session.
my session functions are
use strict; use warnings; use CGI; use CGI qw(:standard :html3); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use Data::Dumper; use URI::Escape; use vars qw($SELF_URL $session); sub sess_set_key_value { my $self = shift; my ($session, $key, $value) = @_; $session->param($key, $value) or dienice("Enter a proper key / value pair"); if ($self->is_debug_set) { my $id = $session->id(); print "SESSION ID - $id\n"; print "SESSION SET Key - $key, Value - $value\n"; } return 1; } sub sess_get_key_value { my $self = shift; my ($session, $key) = @_; my $value = $session->param($key); #dienice("Enter a proper key "); if ($self->is_debug_set) { my $id = $session->id(); print "SESSION ID - $id\n"; print "SESSION GET Key - $key, Value - $value\n"; } return $value; }
I am sure that my session is not lost.But not able to retrive data from it. Where i am going wrong in my code.I need to retrive previous value also.
can any one help me in this regard.
Thanks,
Srins.

In reply to Getting Problem while retriving previous parameter from Session using perl by srins

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.