#!/usr/bin/perl -wT # Loads modules use CGI; use CGI::Fast; use DBI; require "./methods.cgi"; use CGI::Carp qw( fatalsToBrowser ); use Time::HiRes qw(gettimeofday); use strict; use lib "/home/myaccount/perl-lib"; $ENV{'PATH'} = "/usr/local/bin:/usr/bin:/bin"; # (to MIME::Lite) # We´re online? my $online = 1; my $mysqlhost = "mysql.myaccount.com"; if ( $ENV{SERVER_NAME} eq "127.0.0.1" ) { $online = 0; $mysqlhost = "localhost"; } # Connects to mysql [code] # Start of CGI::Fast loop while( my $q = new CGI::Fast ) { # Start cronometer my $elapsed = 0.000; my $t0; my $t1; if ( $online == 1 ) { $t0 = gettimeofday; } # Reading parameters my $cookie = check_string( $q->cookie( -name => "cookie" ) ); my $section = check_string( $q->param("section") ); my $start = check_string( $q->param("start") ); defined $start or $start = 1; my $start_mysql = $start - 1; my $rec_p_pag = 30; # Global vars my $now = lc formatdate (time); # Balizamento da ação, conforme a section solicitada if ( $section eq "this" ) { this(); } else { that(); } # end of chronometer if ( $online == 1 ) { $t1 = gettimeofday; $elapsed = $t1 - $t0; print $elapsed; } sub this { # Query $dbh->do ( ...query ); # Loading hash my %things = load_hash_things(); # starting the html print "Content-type: text/html\n\n"; ...html } ############# # that ############# sub that { ... } } # END OF CGI::FAST LOOP