File: default.cgi

package info (click to toggle)
sporum 1.8b1-3.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,108 kB
  • ctags: 676
  • sloc: perl: 14,300; makefile: 52
file content (46 lines) | stat: -rwxr-xr-x 871 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl

use SmallPigVars qw($config);
use SmallPig;

use SPDB;
use SPCGI;

use Templates::Default;

use strict;

my $lang;

sub main{
# print "Content-type: text/html\n\n";      

  # --- create a SPDB object
  my $spdb = SPDB->new();
  
  my $spcgi = SPCGI->new($spdb);
  $spcgi->set_state_for_client();
  
  my $STATE = $spcgi->{'STATE'};
  my $dpage = $STATE->{'dpage'};

  $lang = SmallPig::get_lang_ptr($STATE->{'lang'}, "default");

  my $template;
  if($dpage){
      # --- create a template object
      $template = Templates::Default->new($spcgi, $spdb);
  }
  else{
      require Templates::Caution;
      # --- create a template object
      $template = 
	Templates::Caution->new($spcgi, $spdb, "", 
				$lang->{'cant_found_page'}, 
				"$config->{'cgidir'}/index.cgi");
  }
  $template->print_http_header();
  $template->print_template();
}

main();