http://qs321.pair.com?node_id=164034


in reply to Re: Re: Yet another Uninitialized value
in thread Yet another Uninitialized value

Well, this warning means that either $total_hours or $total_minutes contains undef. Since previous line has
$total_hours = $row[4] * 60;
and it doesn't cause a warning then $total_hours can be excluded from suspect list. $total_minutes gets its value from $row[5] which seems to be undefined. Are you sure that your query is correct and returns correct number of rows?

Probably fetchrow doesn't return what you expect it to return. Often to help myself debugging simular problems I use Data::Dumper to check if variables really have data I expect them to have. Try to add after line with fetchrow

use Data::Dumper; print Dumper(\@row);
to find out actual content of @row. Once bug is fixed you can remove this debug print.

--
Ilya Martynov (http://martynov.org/)

Replies are listed 'Best First'.
Re: Re: Re: Re: Yet another Uninitialized value
by nlafferty (Scribe) on May 04, 2002 at 18:17 UTC
    Everything looks ok in @row. Only $row[6] is undef. Here is my output:
    $VAR1 = [ '26928', 'normal', '2002-04-29 15:17:06-04', '2002-04-29 15: +19:04-04', '12', '12', 'asdfsad' ]; 2002-04-29 15:17 15:19 12:12 asd +fsad $VAR1 = [ '26929', 'normal', '2002-04-29 17:18:23-04', '2002-04- +29 17:18:42-04', '12', '12', '' ]; 2002-04-29 17:18 17:18 12:12 $VAR1 = [ '26930', 'normal', '2002-05-0 +1 16:36:47-04', '2002-05-01 16:37:24-04', '14', '15', '' ]; 2002-05-01 16:36 16:37 14:15 $VAR1 = [ '26931', 'normal', '2002-05-0 +3 15:57:20-04', '2002-05-03 16:44:32-04', '12', '12', '' ]; 2002-05-03 15:57 16:44 12:12 $VAR1 = [ '26932', 'normal', '2002-05-0 +3 16:44:37-04', '2002-05-03 16:44:44-04', '12', '12', '' ]; 2002-05-03 16:44 16:44 12:12 $VAR1 = [ '26933', 'normal', '2002-05-0 +3 16:46:42-04', '2002-05-03 17:29:08-04', '12', '12', '' ]; 2002-05-03 16:46 17:29 12:12 $VAR1 = [ '26934', 'normal', '2002-05-0 +3 17:29:12-04', '2002-05-03 17:29:19-04', '12', '12', '' ]; 2002-05-03 17:29 17:29 12:12 $VAR1 = [ '26935', 'normal', '2002-05-0 +3 17:57:24-04', '2002-05-03 18:05:10-04', '13', '14', '' ];
    Perhaps my SELECT statement would help?
    $main::SQL="SELECT oid,* FROM timeclock WHERE username = '$username' A +ND start_stamp >= '$start_date' AND end_stamp <= '$end_date' ORDER BY + start_stamp";
      Not sure what is the problem but couple of hints/ideas:
      • DBI returns undef if database cell contains NULL. May be there is a problem in your database.
      • There is one problem with your query. You use astersk in it but in most cases it is bad idea. Check this node and this node for explanation why.
      • One wierd thing. For me (perl 5.6.1) Data::Dumper prints undef when it encounters undefined value in data structure. In your output I see just ''. What does it mean? Well,.. I don't know :(

      --
      Ilya Martynov (http://martynov.org/)