From: Dave B. <db...@th...> - 2007-09-08 00:56:24
|
OK, guys, I have to admit I am lost in the woods here. I have installed MH, fumbled my way to a bit of perl code, starting from the example test_x10.pl, in a separate "Home" directory. I can start MH and with the proper -code_dir syntax, it runs my script, along with gobs of default code that resides in various directories. All the parts I ordered are finally together, and I have a little time to start working on my simple security system. I am trying to configure in a W800_RF32A receiver, and use it to catch data strings from a number of DS-10A and a few PalmPads. I located the code example module 'X10_W800.pm', and attempted to cut the code from that (below the =cut line?) and add it to the beginning of my working script. When I start it up, MH throws a bunch of errors, and fails, flagging problems in my code that weren't problems before I added the X10_W800.pm text. Clearly, I don't understand all the different file formats (.pl, .ini, .mht, .pm, etc.) or how to work these together into a package that works! There are tons of examples supplied, but I'm still trying to figure out the very basics! I could sure use some startup help! Dave I chopped out the small amount of real "guts" in my code, simplifying it to: # Category=Test my $code = 'ABC'; my $code_time = time; if (time-$code_time > 5 and $code ne '') { $code = ''; print_log "Startup timeout finished."; } if ($code eq '1234') { print_log "Code matched 1234!"; $code = ''; } if ($code eq '4321') { print_log "Code matched 4321!"; $code = ''; } That works, as far as it goes. But when I paste in the code from X10_W800.pm at the top, I get the following, after all the normal initialization: 09/07/07 05:51:45 PM Evaluating user code 09/07/07 05:51:45 PM Oops1: String found where operator expected at (eval 113) line 2219, near "print_log "Startup timeout finished."" 09/07/07 05:51:45 PM Oops1: (Do you need to predeclare print_log?) 09/07/07 05:51:45 PM Oops1: String found where operator expected at (eval 113) line 2223, near "print_log "Code matched 1234!"" 09/07/07 05:51:45 PM Oops1: (Do you need to predeclare print_log?) 09/07/07 05:51:45 PM Oops1: String found where operator expected at (eval 113) line 2228, near "print_log "Code matched 4321!"" 09/07/07 05:51:45 PM Oops1: (Do you need to predeclare print_log?) Error in user code file ./../data/mh_temp.user_code 09/07/07 05:51:45 PM: 09/07/07 05:51:45 PM Oops1: (Do you need to predeclare print_log?) syntax error at (eval 113) line 2228, near "print_log "Code matched 4321!"" Line 2223: print_log "Code matched 1234!"; Line 2224: $code = ''; Line 2225: } Line 2226: Line 2227: if ($code eq '4321') { Line 2228: print_log "Code matched 4321!"; Line 2229: $code = ''; Line 2230: } Line 2231: $Benchmark_Members{'test_x10'} += &get_tickcount - $benchmark_tic kcount if $benchmark_tickcount and $Benchmark_Members{on_off_flag}; Line 2232: Line 2233: } # End of test_x10#------------------------------------------------ - C:\MISTER~1\mh\bin> |