Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Yet another Uninitialized value

by Maclir (Curate)
on May 04, 2002 at 17:01 UTC ( [id://164023]=note: print w/replies, xml ) Need Help??


in reply to Yet another Uninitialized value

Some preliminary questions:
  • Which line in your listing is line 260?
  • Are you running with strict and warnings?
  • What is the result of the first sprintf?

Replies are listed 'Best First'.
Re: Re: Yet another Uninitialized value
by nlafferty (Scribe) on May 04, 2002 at 17:11 UTC
    This looks to be what is being complained about.
    $all_minutes = $total_hours + $total_minutes;
    #!/usr/bin/perl -w use strict;

    The result of this is the Total hours and total minutes of each day/row in the db
      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/)

        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";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://164023]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-03-28 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found