Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^14: RFC: Proposed tutorial - simple login script using CGI::Application

by Anonymous Monk
on Jan 25, 2016 at 11:22 UTC ( #1153559=note: print w/replies, xml ) Need Help??


in reply to Re^13: RFC: Proposed tutorial - simple login script using CGI::Application
in thread RFC: Proposed tutorial - simple login script using CGI::Application

Thanks for your inputs, I have updated the relevant code .

perl -wc VPage.pm

VPage.pm syntax OK
VPage.pm file and using same Login.pm package MyLib::VPage; use strict; use lib '/var/www/cgi-bin/WebApp/libs'; use base 'MyLib::Login'; sub cgiapp_init { my $self = shift; $self->SUPER::cgiapp_init; $self->authen->protected_runmodes( 'myrunmode', ); } sub myrunmode: StartRunmode { my $self = shift; my $template = $self->load_tmpl("myrunmode.html"); ### guts of old vpage.cgi go in here print "Testing after login success"; # im doing lot of process with +CGI and perl script $template->param({ OUPUT => $output, # your output goes in here... }); return $template->output; } 1;
vpage.pl - file #!/usr/bin/perl use strict; use lib '/var/www/cgi-bin/WebApp/libs'; use MyLib::VPage; my $webapp = MyLib::VPage->new( PARAMS => { cfg_file => ['simple.ini', 'vpage.ini'], format => 'equal', }, ); $webapp->run();

Replies are listed 'Best First'.
Re^15: RFC: Proposed tutorial - simple login script using CGI::Application
by scorpio17 (Canon) on Jan 25, 2016 at 17:56 UTC
    You can't use a print statement in a runmode like this (better read the CGI::Application docs more carefully: see the "Important note about run mode methods" section. It says, "never print to stdout"!). Change your "print" statement to this:
    my $output = "Testing after login success.\n";
    Then make sure your myrunmode.html template looks something like this:
    <html> <head> <title>VPage</title> </head> <body> <TMPL_IF OUTPUT><TMPL_VAR OUTPUT></TMPL_IF> </body> </html>

    Note that the OUPUT variable in the template gets populated with the value of the $output variable in the runmode in the $template->param() statement.

Re^15: RFC: Proposed tutorial - simple login script using CGI::Application
by Anonymous Monk on Feb 16, 2016 at 12:20 UTC

    Hi, I need a help , if session got expired how can I redirect to login page

      Hi, I need a help , if session got expired how can I redirect to login page

      Bizzare question, that should happen automatically, how are you testing this?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1153559]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2023-02-07 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (40 votes). Check out past polls.

    Notices?