Thanks David!

On Dec 15, 2011 6:46 PM, "David Norwood" <dnorwood2@yahoo.com> wrote:
Okay, i fixed this and submitted the change to cvn.  Sorry it took so long.  Changed the order of commands in the trigger_run subroutine so $@ is valid when it's tested. 

David  


On 11/29/2011 11:31 AM, Jason Sharpee wrote:

Hi David,

When I create a trigger with obviously bad code "This is garbage code"
, the check for errors doesnt seem to work.


Code:
sub trigger_run {
    my ($name,$expire) = @_;
    if (!exists $triggers{$name}) {
        &print_log("trigger_run: trigger '$name' does not exist");
        return;
    }
    my ($trigger, $code, $type, $triggered) = trigger_get($name);
    &print_log ("trigger_run: running trigger code for: $name")
      if $Debug{trigger};
    eval $code;
    trigger_set($trigger, $code, $type, $name, 1, $Time);
    &print_log ("trigger_run: finished running trigger code for: $name")
      if $Debug{trigger};
    if ($@) {
            &print_log("Error: trigger '$name' failed to run cleanly");
            &print_log("  Code = $code");
            &print_log("  Result = $@");
            # At this point we could opt to disable the trigger
            # but it is likely more useful to have a repeating error message
            # to let the user know that something is wrong
            # The following hash entry allows us to show the error in the
            #  web interface
            $triggers{$name}{code_error} = $@;
    } else {
            delete $triggers{$name}{code_error};
    }
    &trigger_expire($name) if $expire;
    return;


Log:
11/29/11 02:09:40 PM trigger_run: running trigger code for: Test
11/29/11 02:09:40 PM trigger Test already exists, modifying
11/29/11 02:09:40 PM trigger_set: trigger=time_now '12 pm' code=This is garbage code type=NoExpire name=Test
      replace=1 triggered=1322593780 new_name=
11/29/11 02:09:40 PM trigger_run: finished running trigger code for: Test
11/29/11 02:09:40 PM triggers_save: 0 expired, 8 saved
11/29/11 02:09:40 PM triggers_save: 0 expired, 8 saved
11/29/11 02:09:40 PM triggers_save: no triggers changed



On Mon, Nov 28, 2011 at 9:28 PM, David Norwood <dnorwood2@yahoo.com> wrote:
I added the code to check for trigger errors, and $@ was getting populated in my tests.  Would you post the code snippet you were trying to run?  
 
David


On 11/28/2011 2:57 PM, Jason Sharpee wrote:
I was editing the lib/trigger_code.pl

Well, I solved half of the issue.  
The function most of my triggers were using is no longer available,  it was technically bad code, and wouldnt evaluate regardless.   However, it would appear that the errors coming from the "eval $code" are not populating $@ and MH is not catching them at all.

In short: Triggers work, however, I am not getting errors from eval executions anymore.

-J


On Mon, Nov 28, 2011 at 9:43 AM, Marc MERLIN <marc_mh@merlins.org> wrote:
On Mon, Nov 28, 2011 at 07:47:50AM -0500, Jason Sharpee wrote:
> Hi All,
>
>    I noticed that none of my triggers are working on the Insteon branch.  I
> traced the code down to triggers_code.pl to the triggers_run eval in which
> it appears to do nothing.  If I inject garbage into that eval it doesnt
> complain or do anything either.
>
> Anyone have any ideas on what is going on here? Is this some sort of
> environment issue with Ubuntu 10.10?

That doesn't help you directly, but my triggers seem ok.

Which file are you editting the triggers in? Is that in a directory that's
being seen by your insteon branch config?
(I have different data dirs for mh-svn and mh-insteon).

Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                     .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365




------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d


________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365



------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365





------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d


________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365



------------------------------------------------------------------------------
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.
But none more important than the need to reduce IT complexity
while improving strategic productivity.  Learn More!
http://www.accelacomm.com/jaw/sdnl/114/51507609/
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365