= 18 = package MyLib::Simple; = 19 = use strict; = 20 = = 21 = use lib '/var/www/cgi-bin/WebApp/libs'; = 22 = use base 'MyLib::Login'; = 23 = = 24 = sub cgiapp_init { = 25 = my $self = shift; = 26 = = 27 = $self->SUPER::cgiapp_init; = 28 = = 29 = # define runmodes (pages) that require successful login: = 30 = $self->authen->protected_runmodes( = 31 = 'private', = 32 = 'private2', = 33 = ); = 34 = = 35 = } = 36 = = 37 = sub index : StartRunmode { = 38 = my $self = shift; = 39 = my $template = $self->load_tmpl("index.html"); = 40 = $template->param({ = 41 = NAME => 'INDEX', = 42 = MYURL => $self->query->url(), = 43 = USER => $self->authen->username, = 44 = }); = 45 = return $template->output; = 46 = } = 47 = = 48 = sub public : Runmode { = 49 = my $self = shift; = 50 = my $template = $self->load_tmpl("default.html"); = 51 = my $msg = "You can see this without logging in.
"; = 52 = $template->param(MESSAGE => $msg); = 53 = $template->param(NAME => 'Public'); = 54 = $template->param(MYURL => $self->query->url); = 55 = return $template->output; = 56 = } = 57 = = 58 = sub public2 : Runmode { = 59 = my $self = shift; = 60 = my $template = $self->load_tmpl("default.html"); = 61 = my $msg = "You can see this without logging in.
"; = 62 = $template->param(MESSAGE => $msg); = 63 = $template->param(NAME => 'Public2'); = 64 = $template->param(MYURL => $self->query->url); = 65 = = 66 = ### die "made it here\n"; = 67 = = 68 = return $template->output; = 69 = } = 70 = = 71 = sub private : Runmode { = 72 = my $self = shift; = 73 = my $template = $self->load_tmpl("default.html"); = 74 = my $msg = "You must log in to see this."; = 75 = $template->param(MESSAGE => $msg); = 76 = $template->param(NAME => 'Private'); = 77 = $template->param(MYURL => $self->query->url); = 78 = return $template->output; = 79 = } = 80 = = 81 = sub private2 : Runmode { = 82 = my $self = shift; = 83 = my $template = $self->load_tmpl("default.html"); = 84 = my $msg = "You must log in to see this."; = 85 = $template->param(MESSAGE => $msg); = 86 = $template->param(NAME => 'Private2'); = 87 = $template->param(MYURL => $self->query->url); = 88 = return $template->output; = 89 = } = 90 = = 91 = = 92 = 1; = 93 =