-
Notifications
You must be signed in to change notification settings - Fork 130
PerlInfo
If you are new to perl, mh can be intimidating, there is a nice perl faq written by Robert ? at : http://www.sthomas.net/roberts-perl-tutorial.htm
After becoming familiar, the next hurdle are the perl object methods.
e.g. set $couch_lamp ON; $couch_lamp->set(ON);
both do exactly the same thing.
Most of the MH code is written in the style of perl that minimizes the extra punctuation. I thought maybe this would help. In perl:
functionname($arg1, $arg2, $arg3);
can usually be replaced by
functionname $arg1, $arg2, $arg3;
and
$object->method($arg1, $arg2, $arg3);
can usually be replaced by
method $object $arg1, $arg2, $arg3;
I suppose people that are very familiar with perl like to write it without the parens and "->" but for someone trying to figure out perl syntax it is very confusing. Then you can add things that look like new keywords but aren't:
use constant OFF => 'off'
All this means that you can write something neat looking:
set $light OFF
But for a new perl programmer, this is easier to understand:
$light->set('off');
In my opinion, if you try to use the "set $light OFF" syntax and you don't understand these shortcuts then your programming will continuously be by trial and error. I certainly don't have all the subtleties of the perl order of operations memorized so I don't write it like that.