Test.
[reportero_perl.git] / reportero
blobebbd0166d390b7de69c5e899ba6feabc111089fa
1 #!/bin/env perl
2 # Test reporting program
4 use warnings;
5 use DBI;
6 use CGI qw(:standard);
7 use CGI::Carp qw(fatalsToBrowser);
10 $db_name = "tarificador";
11 $db_user = "tarificador";
12 $db_passwd = "n3ur0d3s4rr0ll008";
14 sub
15 db_search
17   my $dbh = shift ;
18   my $sql = param('sql');
20   my $sth = $dbh->prepare("$sql");
21   $sth->execute();
23   print <<'  END'
24     <html>
25     <head></head>
26     <body>
27   END
28   ;
30   my $count;
31   while (my $hash = $sth->fetchrow_hashref)
32   {
33     print 
34       "$hash->{id},$hash->{fecha_hora},$hash->{origen},$hash->{destino}<br/>";
35     print "TEST"
36     $count++;
37   }
39   print <<'  END'
40     </body>
41     </html>
42   END
43   ;
46 my $dbh = DBI->connect("dbi:mysql:dbname=$db_name"
47     , "$db_user", "$db_passwd")
48     or die "ERROR: Cannot connect to DB: $DBI::errstr!\n";
50 print header();
52 db_search($dbh);