chefchanyu has asked for the wisdom of the Perl Monks concerning the following question:
Hi: I just start learning about the Perl DBI. my script got me a Strange result. "Use of uninitialized value in join or string at cacti.pl line 17." I don't see any problem with line 17....
#!/usr/bin/perl -w use strict; use DBI; my $dbh_m = DBI->connect("dBi:mysql:cacti:localhost", "cacti", "cacti") or die("Cannot connect: $DBI::errstr\n"); my $sql = qq(select * from data_template_data); my $sth_m = $dbh_m->prepare($sql); $sth_m->execute; while(my $p = $sth_m->fetch){ print "MySQL: @$p\n"; } $dbh_m->disconnect;
[cacti@cacti other]$ perl cacti.pl Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 3 0 0 3 2 on |host_description| - Hard Drive Space on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 4 0 0 4 1 |host_description| - CPU Usage - System on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 5 0 0 5 1 |host_description| - CPU Usage - User on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 6 0 0 6 1 |host_description| - CPU Usage - Nice on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 7 0 0 7 2 on |host_description| - Noise Level on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 8 0 0 8 2 on |host_description| - Signal Level on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 9 0 0 9 2 on |host_description| - Wireless Transmits on 300 + Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 10 0 0 10 2 on |host_description| - Wireless Re-Transmits on + 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 11 0 0 11 4 |host_description| - Load Average on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 13 0 0 13 6 |host_description| - Memory - Free on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 15 0 0 15 6 |host_description| - Memory - Free Swap on 300 + Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 16 0 0 16 7 |host_description| - Processes on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 17 0 0 17 5 |host_description| - Logged in Users on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 18 0 0 18 10 |host_description| - Ping Host on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 19 0 0 19 1 |host_description| - Total Users on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 20 0 0 20 1 |host_description| - Total Logins on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 22 0 0 22 1 |host_description| - File System Reads on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 23 0 0 23 1 |host_description| - File System Writes on 300 + Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 24 0 0 24 1 |host_description| - Cache Checks on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 25 0 0 25 1 |host_description| - Cache Hits on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 26 0 0 26 1 |host_description| - Open Files on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 27 0 0 27 1 |host_description| - 5 Minute CPU on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 30 0 0 30 1 |host_description| - Load Average - 1 Minute on + 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 31 0 0 31 1 |host_description| - Load Average - 5 Minute on + 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 32 0 0 32 1 |host_description| - Load Average - 15 Minute o +n 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 33 0 0 33 1 |host_description| - Memory - Buffers on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 34 0 0 34 1 |host_description| - Memory - Free on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 35 0 0 35 2 on |host_description| - Volumes on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 36 0 0 36 2 on |host_description| - Directory Entries on 30 +0 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 37 0 0 37 11 on |host_description| - Hard Drive Space on 30 +0 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 38 0 0 38 2 on |host_description| - Errors/Discards on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 39 0 0 39 2 on |host_description| - Unicast Packets on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 40 0 0 40 2 on |host_description| - Non-Unicast Packets on +300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 41 0 0 41 2 on |host_description| - Traffic on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 55 0 0 42 2 |host_description| - CPU Utilization on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 56 0 0 43 12 |host_description| - Hard Drive Space on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 57 0 0 44 12 |host_description| - CPU Utilization on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 58 0 0 45 1 |host_description| - Processes on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 59 0 0 46 1 |host_description| - Logged in Users on 300 Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 62 13 3 13 6 |host_description| - Memory - Free Localhost - Me +mory - Free <path_rra>/localhost_mem_buffers_3.rrd on 300 Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 63 15 4 15 6 |host_description| - Memory - Free Swap Localhost + - Memory - Free Swap <path_rra>/localhost_mem_swap_4.rrd on 300 Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 64 11 5 11 4 |host_description| - Load Average Localhost - Loa +d Average <path_rra>/localhost_load_1min_5.rrd on 300 Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 65 17 6 17 5 |host_description| - Logged in Users Localhost - +Logged in Users <path_rra>/localhost_users_6.rrd on 300 Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 66 16 7 16 7 |host_description| - Processes Localhost - Proces +ses <path_rra>/localhost_proc_7.rrd on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 68 0 0 47 1 |host_description| - Memory - Cache on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 69 0 0 48 1 on |host_description| - on 300 Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 70 0 0 49 0 10 minutes on 600 Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 71 70 8 49 0 10 minutes 10 minutes /var/www/cacti_rrd/MMS/Dail +y/CDR_TOTAL_901S902M905S906WAPENC.rrd on 600 Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. Use of uninitialized value in join or string at cacti.pl line 17. MySQL: 72 70 9 49 0 10 minutes 10 minutes /var/www/cacti_rrd/MMS/Dail +y/CDR_TOTAL_901R902M905S906FOREIGNOPTUS.rrd on 600
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl DBI help
by Perlbotics (Bishop) on Aug 21, 2012 at 11:20 UTC | |
Avoid select *
by chacham (Prior) on Aug 21, 2012 at 16:07 UTC | |
Re: Perl DBI help
by pvaldes (Chaplain) on Aug 21, 2012 at 13:20 UTC | |
by erix (Prior) on Aug 21, 2012 at 13:42 UTC |
Back to
Seekers of Perl Wisdom