Error in user code file

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in user code file

Michael Starks
Hello Everyone,

This is my first post.  I'm looking forward to having lots of fun with
Mister House.  Anyway, I seem to have messed something up after trying
to clean up the default devices in the setup section of the web page.
For example, I deleted the garage entries since I don't have a garage.
Now when I go to start mh, I get the following error:

-------
Error in user code file ./../data/mh_temp.user_code

  01/28/06 04:59:32 PM: Global symbol "$test_light2" requires explicit
package name at (eval 384) line 55.
Global symbol "$All_Lights" requires explicit package name at (eval 384)
line 57.
Global symbol "$test_light1" requires explicit package name at (eval
384) line 61.
Global symbol "$test_light1" requires explicit package name at (eval
384) line 62.
Line 50:  # interface name as a second parameter, like this:
Line 51:  #    $test_light_1 = new X10_Item('A1', 'CM11');
Line 52:  #    $test_light_1 = new X10_Item('B1', 'CM17');
Line 53:
Line 54:  #set $test_light2 $state if $state = said $v_test_light_2;
Line 55:  tie_items $v_test_light2 $test_light2;
Line 56:
Line 57:  set $All_Lights $state if $state = said $v_test_lights;
Line 58:
Line 59:                                # Toggle the light on/off every
30 seconds
Line 60:  if ($New_Second and !($Second % 30)) {
---------

I've searched the archives and seen other people with similar issues,
but the solution escapes me.  Thanks in advance for any help.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error in user code file

Gaetan Lord
Perl need to know with what type of data he's dealing with.
When you try to use $All_Lights, $test... , perl doesn't know how he should
treat the data, this could be a simple variables, or an object.

Because you comment out line 51, then $test_light_1 is not defined, and
when you use
that variable on line 61, you get that error message Samething with
test_light2, and $All_Lights

By doing a "new X10_Item", you are actually creating an object, and perl
will now know
how to deal with. If you have to create a variable, then you need to
declare it with
my $NewVariable;
Then after you will be able to use it.

HTH

Michael Starks wrote:

>Hello Everyone,
>
>This is my first post.  I'm looking forward to having lots of fun with
>Mister House.  Anyway, I seem to have messed something up after trying
>to clean up the default devices in the setup section of the web page.
>For example, I deleted the garage entries since I don't have a garage.
>Now when I go to start mh, I get the following error:
>
>-------
>Error in user code file ./../data/mh_temp.user_code
>
>  01/28/06 04:59:32 PM: Global symbol "$test_light2" requires explicit
>package name at (eval 384) line 55.
>Global symbol "$All_Lights" requires explicit package name at (eval 384)
>line 57.
>Global symbol "$test_light1" requires explicit package name at (eval
>384) line 61.
>Global symbol "$test_light1" requires explicit package name at (eval
>384) line 62.
>Line 50:  # interface name as a second parameter, like this:
>Line 51:  #    $test_light_1 = new X10_Item('A1', 'CM11');
>Line 52:  #    $test_light_1 = new X10_Item('B1', 'CM17');
>Line 53:
>Line 54:  #set $test_light2 $state if $state = said $v_test_light_2;
>Line 55:  tie_items $v_test_light2 $test_light2;
>Line 56:
>Line 57:  set $All_Lights $state if $state = said $v_test_lights;
>Line 58:
>Line 59:                                # Toggle the light on/off every
>30 seconds
>Line 60:  if ($New_Second and !($Second % 30)) {
>---------
>
>I've searched the archives and seen other people with similar issues,
>but the solution escapes me.  Thanks in advance for any help.
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems?  Stop!  Download the new AJAX search engine that makes
>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
>________________________________________________________
>To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365
>  
>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error in user code file

mp3jfast
In reply to this post by Michael Starks
Hi,

I think you must declare your variables using "my" infront of it.

Part of mine code:

$Garden_Water                 = new X10_Item ('G12');

# test if all lights of sleeping room
$test_lightsA                 = new X10_Item ('A');

my $Corridor_Upstairs_Motion_timeout=15;

John
Michael Starks wrote:

> Hello Everyone,
>
> This is my first post.  I'm looking forward to having lots of fun with
> Mister House.  Anyway, I seem to have messed something up after trying
> to clean up the default devices in the setup section of the web page.
> For example, I deleted the garage entries since I don't have a garage.
> Now when I go to start mh, I get the following error:
>
> -------
> Error in user code file ./../data/mh_temp.user_code
>
>   01/28/06 04:59:32 PM: Global symbol "$test_light2" requires explicit
> package name at (eval 384) line 55.
> Global symbol "$All_Lights" requires explicit package name at (eval 384)
> line 57.
> Global symbol "$test_light1" requires explicit package name at (eval
> 384) line 61.
> Global symbol "$test_light1" requires explicit package name at (eval
> 384) line 62.
> Line 50:  # interface name as a second parameter, like this:
> Line 51:  #    $test_light_1 = new X10_Item('A1', 'CM11');
> Line 52:  #    $test_light_1 = new X10_Item('B1', 'CM17');
> Line 53:
> Line 54:  #set $test_light2 $state if $state = said $v_test_light_2;
> Line 55:  tie_items $v_test_light2 $test_light2;
> Line 56:
> Line 57:  set $All_Lights $state if $state = said $v_test_lights;
> Line 58:
> Line 59:                                # Toggle the light on/off every
> 30 seconds
> Line 60:  if ($New_Second and !($Second % 30)) {
> ---------
>
> I've searched the archives and seen other people with similar issues,
> but the solution escapes me.  Thanks in advance for any help.
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> ________________________________________________________
> To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365
>
>
>  



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error in user code file

Michael Starks
In reply to this post by Gaetan Lord
Gaetan Lord wrote:
> Perl need to know with what type of data he's dealing with.
> When you try to use $All_Lights, $test... , perl doesn't know how he should
> treat the data, this could be a simple variables, or an object.

Thanks Gaetan and John for the replies.  Maybe I wasn't too clear in my
original post.  I haven't tried to do anything custom yet.  The only
thing I was trying to do was clean up the web interface.  There were a
bunch of things in there like 'fountain' and 'garage' which weren't
applicable to my house, so I deleted them.  It seems to be based largely
on the principle developer's house.  So, after I did that, mh would not
start.

I suppose I could reinstall and replace mh.ini, but I suspect I would be
in the same situation once I started to clean up again.  Maybe the
better question is, "What is the proper way to customize the interface
to get rid of the extra stuff which isn't applicable?"  Shouldn't it
come clean by default and the user just adds what they have in terms of
devices, floor plan, etc?


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error in user code file

Michael Starks
In reply to this post by Michael Starks
Michael Starks wrote:

> Hello Everyone,
>
> This is my first post.  I'm looking forward to having lots of fun with
> Mister House.  Anyway, I seem to have messed something up after trying
> to clean up the default devices in the setup section of the web page.
> For example, I deleted the garage entries since I don't have a garage.
> Now when I go to start mh, I get the following error:
>
> -------
> Error in user code file ./../data/mh_temp.user_code

Ok, I reinstalled and again deleted all of the devices which are not
applicable to me.  I was able to reproduce the above result.  What is
the proper way to get rid of this stuff?  Thanks.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error in user code file

Neil Cherry
Michael Starks wrote:

> Michael Starks wrote:
>> Hello Everyone,
>>
>> This is my first post.  I'm looking forward to having lots of fun with
>> Mister House.  Anyway, I seem to have messed something up after trying
>> to clean up the default devices in the setup section of the web page.
>> For example, I deleted the garage entries since I don't have a garage.
>> Now when I go to start mh, I get the following error:
>>
>> -------
>> Error in user code file ./../data/mh_temp.user_code
>
> Ok, I reinstalled and again deleted all of the devices which are not
> applicable to me.  I was able to reproduce the above result.  What is
> the proper way to get rid of this stuff?  Thanks.
In the log file there is usually more to the message. You need to
provide us more information to help you get rid of it.

If it looks like this:

syntax error at ../lib/read_table_xml.pl line 202, near ")
||"
Compilation failed in require at mh line 4047.
mh had an error on startup, will not restart

That was my fault and you can replace ~mh/lib/read_table_xml.pl
with the one attached.

If it's something else we still need more information.

--
Linux Home Automation         Neil Cherry       [hidden email]
http://www.linuxha.com/                         Main site
http://linuxha.blogspot.com/                    My HA Blog
http://home.comcast.net/~ncherry/               Backup site

read_table_xml.pl (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Error in user code file

Michael Starks
Neil Cherry wrote:

> In the log file there is usually more to the message. You need to
> provide us more information to help you get rid of it.
>
> If it looks like this:
>
> syntax error at ../lib/read_table_xml.pl line 202, near ")
> ||"
> Compilation failed in require at mh line 4047.
> mh had an error on startup, will not restart
>
> That was my fault and you can replace ~mh/lib/read_table_xml.pl
> with the one attached.
>
> If it's something else we still need more information.

I checked out the 'View Print Log' and 'View Backup Log' buttons, but
there were no errors.  As a further test, I simply deleted test_light1
from the 'edit items' section.  Upon restarting, I got the error below
and the web server exited.  Replacing test.mht from a backup restores
things to normal.  Thanks.
--------------
Error in user code file ./../data/mh_temp.user_code

  02/04/06 01:47:01 PM: Global symbol "$test_light1" requires explicit
package name at (eval 385) line 2093.
Global symbol "$test_light1" requires explicit package name at (eval
385) line 2094.
Line 2088:
Line 2089:  set $All_Lights $state if $state = said $v_test_lights;
Line 2090:
Line 2091:                              # Toggle the light on/off every
30 seconds
Line 2092:  if ($New_Second and !($Second % 30)) {
Line 2093:      my $state = ('on' eq state $test_light1) ? 'off' : 'on';
Line 2094:      set $test_light1 $state;
Line 2095:      my $remark = "Light set to $state";
Line 2096:      print_log "$remark";
Line 2097:  #   speak $remark;
Line 2098:  }

[1]+  Exit 1                  ./mh -tk 0



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error in user code file

Neil Cherry
Michael Starks wrote:

> Neil Cherry wrote:
>> In the log file there is usually more to the message. You need to
>> provide us more information to help you get rid of it.
>>
>> If it looks like this:
>>
>> syntax error at ../lib/read_table_xml.pl line 202, near ")
>> ||"
>> Compilation failed in require at mh line 4047.
>> mh had an error on startup, will not restart
>>
>> That was my fault and you can replace ~mh/lib/read_table_xml.pl
>> with the one attached.
>>
>> If it's something else we still need more information.
>
> I checked out the 'View Print Log' and 'View Backup Log' buttons, but
> there were no errors.  As a further test, I simply deleted test_light1
> from the 'edit items' section.  Upon restarting, I got the error below
> and the web server exited.  Replacing test.mht from a backup restores
> things to normal.  Thanks.
> --------------
> Error in user code file ./../data/mh_temp.user_code
>
>   02/04/06 01:47:01 PM: Global symbol "$test_light1" requires explicit
> package name at (eval 385) line 2093.
> Global symbol "$test_light1" requires explicit package name at (eval
> 385) line 2094.
> Line 2088:
> Line 2089:  set $All_Lights $state if $state = said $v_test_lights;
> Line 2090:
> Line 2091:                              # Toggle the light on/off every
> 30 seconds
> Line 2092:  if ($New_Second and !($Second % 30)) {
> Line 2093:      my $state = ('on' eq state $test_light1) ? 'off' : 'on';
> Line 2094:      set $test_light1 $state;
> Line 2095:      my $remark = "Light set to $state";
> Line 2096:      print_log "$remark";
> Line 2097:  #   speak $remark;
> Line 2098:  }
>
> [1]+  Exit 1                  ./mh -tk 0

You would need to turn off the test code (in ~mh/code/test/) the
file is test_x10.pl. You can do this by using the select user code
menu:

Main web page
   -> [ Mr. House ]
     -> [ Setup Mr. House ]
       -> [ User Code Activation ]

Select the offending code (click on the little box next to the
code file) and then click the [ Precess selected files ] button.
I hope I don't offend with the simplification above, I've
been using this kind of format for the last few weeks on the
MH chapters.

--
Linux Home Automation         Neil Cherry       [hidden email]
http://www.linuxha.com/                         Main site
http://linuxha.blogspot.com/                    My HA Blog
http://home.comcast.net/~ncherry/               Backup site


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error in user code file

Michael Starks
Neil Cherry wrote:
> You would need to turn off the test code (in ~mh/code/test/) the
> file is test_x10.pl. You can do this by using the select user code
> menu:
>
> Main web page
>   -> [ Mr. House ]
>     -> [ Setup Mr. House ]
>       -> [ User Code Activation ]

Neil, thanks for the tip.  It was very easy to follow and got me past
that problem.  I didn't realize I had to deselect the test code before
deleting the items.

I've managed to figure out how to make my own code directory and put an
mht file in there.  By looking at test.mht, I was able to get a light
defined and working.  Cool!

I guess I didn't fully understand that some manual hacking was necessary
to get things going.  No biggie, I was just taking the wrong approach
and either misunderstood or didn't find this in the docs, wiki and FAQ.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error in user code file

Neil Cherry
Michael Starks wrote:

> Neil Cherry wrote:
>> You would need to turn off the test code (in ~mh/code/test/) the
>> file is test_x10.pl. You can do this by using the select user code
>> menu:
>>
>> Main web page
>>   -> [ Mr. House ]
>>     -> [ Setup Mr. House ]
>>       -> [ User Code Activation ]
>
> Neil, thanks for the tip.  It was very easy to follow and got me past
> that problem.  I didn't realize I had to deselect the test code before
> deleting the items.

I need to add a few more things to the docs, Wiki and FAQ. Fun part is
that they're in my book. Now I have to figure out how to put them in
the the above but not directly copy the book. While I want to sell the
book I still need to support the community.

> I guess I didn't fully understand that some manual hacking was necessary
> to get things going.  No biggie, I was just taking the wrong approach
> and either misunderstood or didn't find this in the docs, wiki and FAQ.

The Wiki is new so it's a little behind the curve, the docs actually
have everything in there, somewhere. It's just that it needs to be
changed to support a new user's perspective on everything. This will
help decrease the new user's steep learning curve. Writing the book
has helped me figure out a few things to help. When the book is done
I'll get back to work on the Complete Home Control stuff I started
with Alan (http://home.comcast.net/~ncherry/common/24_days/24_days.html).
I have no idea how this is going to go because of legal
obligations to Wiley (my book's publisher). If I want to push
forward with the project I may have to write another book for
Wiley (I'm not too thrilled about that).

--
Linux Home Automation         Neil Cherry       [hidden email]
http://www.linuxha.com/                         Main site
http://linuxha.blogspot.com/                    My HA Blog
http://home.comcast.net/~ncherry/               Backup site


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365