in reply to Problem with enable_watch

enable_watch is not documented to return anything or to set $!. Peeking inside the source, it appears that it intentionally returns undef on error, and only on error. However, the error message is a not stored in $! It is accessible via $c->error().

$c->enable_watch($host) or die("Can't enable watch of $host: ", $c->error(), "\n");

For future reference, please wrap computer text such as code in <c>...</c> tags, and use <p> to start each paraphraph

Replies are listed 'Best First'.
Re^2: Problem with enable_watch
by tayun (Initiate) on Feb 01, 2010 at 16:35 UTC
    The error message is Can't enable watch of test: 520 enable error, unknown watch What does this mean? How do I fix this error? thanks so much for the help
      I don't know anything about Mon or Mon::Client, but it sounds like you need to create the watch somehow before you can enable it. list_watch might give a clue as to what is being expected.