Redirecting the perl script

      Using the javascript in Perl we can redirect the page from perl file to the another perl file

       Step 1  use CGI qw(:standard);

       Step 2   my $JSCRIPT=<<EOF;

                function redirect_GMM()
                {
                window.location.href="http://localhost/cgi-bin/GMW/GMM.pl";
                }   
                EOF
                 ;  
       Step 3  my $q =CGI->new;
               print $q->header('text/html');
               print $q->start_html(-title=>'JJ',-script=>$JSCRIPT);
               print $q->h5('JJ login page');
               print $q->end_html; 

       Step 4   print button(
                         -name =>'GOOD',
                         -value    =>'GOOD',
                         -onclick=>'redirect_GMM()'
                          );

         This code will surely redirect the page when you press the button.

Leave a Comment