Mie Feb 14, 2007 7:41 am
|
 |
perlo
Perlero Nuevo

|
Registrado: 08 Nov 2006
Mensajes: 17
|
|
| Global symbol "$segundos" requires explicit packag |
|
|
No se cual es el error, me pasa con todas las variables; publico el código por las dudas.....
Lo que intenta hacer el programa es extraer 2 campos con datos de la consulta y enviarlos por mail
| Perl: | my $ayer = UnixDate ("yesterday", '%Y-%m-%d');
my $hoy = UnixDate ("today", '%Y-%m-%d'); #
my($dbh, $sth, $sth1, $sth2, $mensaje1, $mensaje2, $mensaje3, $mail);
my(@linea1, @linea2, @linea3);
my $sthtest;
###################################################################
# CONEXION A LA BASE DE DATOS #
###################################################################
#$dbh = ConectarBBDD->connect();
$dbh = conexionBD_read ();
;
###################################################################
# CONSULTA A LA BASE DE DATOS #
###################################################################
$sth = $dbh-> prepare("select sum(A), sum(C) from tabla;") or die("no funciona " . $dbh-> errstr);
$sth-> execute() or die("Error de conexion: " . $sth-> errstr);
my $traigo = "select sum(A), C from tabla";
my $sthtraigo = $dbh-> prepare($traigo)
#$sth1 = $dbh->prepare("select sum(A), sum(C) from tabla;") or die("no funciona " . $dbh->errstr);
#$sth1->execute() or die("Error de conexion: " . $sth1->errstr);
#$sth2 = $dbh->prepare("select sum(A), sum(C) from tabla;) or die("no funciona " . $dbh->errstr);
#$sth2->execute() or die("Error de conexion: " . $sth2->errstr);
###################################################################
# EXTRAIGO DATOS Y PREPARO EL MAIL #
###################################################################
#my ($seg1) = $sth->fetchrow_array;
my ($seg2) = $sth1-> fetchrow_array;
my ($seg3) = $sth2-> fetchrow_array;
my $segundos;
my $ANI;
($segundos, $ANI) = $sthtraigo-> fetcrow_array();
$seg1 += 0;
$seg2 += 0;
$seg3 += 0;
my ($mensaje1, $mensaje2, $mensaje3, $mensaje4);
$mensaje1 = " $segundos $ANI ";
$mensaje2 = "";
$mensaje3 = "";
###################################################################
# PREPARO EL MAIL #
###################################################################
$mail = MIME:: Lite-> new(
From => 'xxx@asdfa.com',
#Bcc=>'',
To => ',
Subject =>'algo ',
Data =>$mensaje1."\n".$mensaje2."\n".$mensaje3."\n".$mensaje4."\n"
) ;
#Pedir que se use SMTP
MIME::Lite->send('smtp ', "algo.com", Timeout => 60 ) ;
###################################################################
# ENVIO EL MAIL #
###################################################################
# Enviamos el mensaje
$mail->send;
###################################################################
# DESCONEXION DE LA BASE DE DATOS #
###################################################################
#Cerramos conexion con BD
$sth->finish; |
|
|
|
|

Mie Feb 14, 2007 9:36 am
|
 |
perlo
Perlero Nuevo

|
Registrado: 08 Nov 2006
Mensajes: 17
|
|
| Como hago... |
|
|
| Hola como hago a su vez para que el programa no me traiga solo una linea y me traiga todas... |
|
Powered by phpBB © 2001, 2005 phpBB Group
|